Calling a Program With CALLPGM or EXEC

How to:

Application developers use Dialogue Manager FOCEXEC procedures for program control and flexibility. Additionally, CALLPGM is used where needed.

CALLPGM also provides application developers with:

The following figure illustrates the use of CALLPGM to call a program within a Dialogue Manager FOCEXEC procedure.

The steps in this process are:

  1. The Dialogue Manager FOCEXEC procedure is located and executed by the server. The command CALLPGM myprog within the procedure finds and loads the external procedure and it is run. The END statement after the CALLPGM line is required syntax to end stacking on input to the application.
  2. The program myprog executes and terminates.

    Note: CALLPGM may call the program several times to allow it to construct and return complete table data, a complete set of messages, or both. See Passing Parameters for more information.

  3. CALLPGM performs one or both of the following actions, which are transparent to the Dialogue Manager FOCEXEC procedure:

    The Dialogue Manager FOCEXEC procedure itself does not need to create an answer set or message.

    The command CALLPGM and EXEC operate the same except EXEC has the advantage of being able to let the EXORDER setting control if FOCEXECs by the same name will be also searched for and which is considered first found (the compiled program or the FOCEXEC.)


Top of page

x
Syntax: How to Call a Program Using CALLPGM or EXEC
CALLPGM progname[,parmval1][,...]
END

or

SET EXORDER=PGM/FEX
EX[EC] progname[parmval1][,...]
END

or

SET EXORDER=PGM/FEX
SET SQLENGINE=CPGFOC
SQL EX PROGRAM [parmval1][,...] 
TABLE FILE SQLOUT 
PRINT field [ON TABLE PCHOLD]
END 
SET SQLENGINE=OFF

where:

progname

Is the name of the program to be run. (If CALLPGM is used, it cannot be another Dialogue Manager FOCEXEC procedure.)

parmval1

Is an optional positional Dialogue Manager parameter passed to progname. A Dialogue Manager parameter is an alphanumeric value. See Passing Parameters for examples.

The length of a single parameter (for example, parmval1) cannot exceed 32,000 characters. The total length of all specified parameters cannot exceed 32,000 characters.

END

Is a required command that terminates CALLPGM or EXEC.


iWay Software