How to:

The EXEC command enables you to call a WebFOCUS procedure and pass parameters to and from the procedure. You can run any WebFOCUS procedure residing on a WebFOCUS Server accessible to the WebFOCUS Server where the calling procedure resides. From a WebFOCUS procedure you can run many other types of procedures, including compiled C programs, CICS transactions, and native RDBMS command files.

For more information, see the Developing WebFOCUS Maintain Applications manual.

Top of page

Syntax: How to Use the EXEC Command

The syntax of the EXEC command is

EXEC progname AT server [KEEP|DROP] [PATH {VAR|LIST}] [FROM var_list] [INTO stacks] [;]



Is the name of the external procedure residing on the remote WebFOCUS Server.

AT server

Identifies the server of the EXEC procedure.

In most situations the Maintain Development Environment supplies this phrase during the deployment phase and you should refrain from coding it yourself. If you do hard code the ATserver clause in your procedure, it will not be changed during deployment. A variable can be used to supply the server name.


Is used to specify additional locations (search paths) the system should use when searching for dependent resources (Master Files, imported modules, and others). The path location names are application names existing within the APPROOT directory structure or application names that have been introduced with the APP MAP command. The search path value can be in the form of a Maintain variable or a list of literal values enclosed in quotes, as follows:

EXEC Procedure AT server PATH "AppDir1 AppDir2 AppDir3" ;
EXEC Procedure AT server PATH MyVariable ;

Is included to pass one or more variables to the external procedure.


Is included to identify the data stack to receive the answer set or sets coming from the external procedure.


Is one or more scalar variables that you pass to the target procedure, where they are received as numbered amper variables. You can pass any scalar variable except for those defined as variable-length character variables (that is, except for those defined as A0 or TX). Unlike the CALL command, you cannot pass stacks to the target procedure.

The length of a single parameter cannot exceed 32,000 characters. The total length of all specified parameters cannot exceed 32,000 characters.


Is one or more stacks, each of which will receive an answer set from the target procedure. To retrieve multiple answer sets, specify multiple stacks. The stacks are populated sequentially as each answer set is returned by the external procedure. You can pass any stack except for those defined using STACK OF.

The number of variables specified in the EXEC command must not exceed the number returned by the external procedure. If the number specified is fewer than the number returned, the extra returned parameters are ignored.


The DROP parameter terminates the server session that the AT server phrase creates if the called procedure is on a different server. The KEEP parameter leaves the server session active for reuse by subsequent external procedures. KEEP is the default.


Terminates the command. Although the semicolon is optional, it is recommended that you include it to allow for flexible syntax and better processing. For more information about the semicolon, see Terminating Command Syntax.