EXEC

How to:

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

Syntax: How to Use the EXEC Command

The syntax of the EXEC command is

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

where:

progname

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

KEEP|DROP

The DROP parameter terminates the server session. The KEEP parameter leaves the server session active for reuse by subsequent external procedures. KEEP is the default.

PATH

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 Data variable or a list of literal values enclosed in double quotation marks ("), as follows:

EXEC Procedure PATH "AppDir1 AppDir2 AppDir3" ;
EXEC Procedure PATH MyVariable ;
FROM

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

INTO

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

var_list

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.

stacks

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.

;

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 a Command's Syntax.