The EXEC(UTE) Statement

The EXEC(UTE) statement is provided as a linkage mechanism to allow control to be passed to non-COBOL subsystems.

General Formats for Format 1


{EXEC or EXECUTE} {CICS or DLI or SQL} text-data END-EXEC

General Formats for Format 2


{EXEC or EXECUTE} text-name text-data END-EXEC

Syntax Rules

  1. Text-data can be any textual data not containing the string END-EXEC.

General Rules for Format 1

  1. The formats EXEC(UTE) CICS, EXEC(UTE) SQL, and EXEC(UTE) DLI cause the appropriate system component (variously known as preprocessors, co-processors and external compiler modules) to be called to process text-data if the corresponding Compiler directive is specified that invokes that system component. If the corresponding Compiler directive has not been specified, the EXEC(UTE) statement is treated as a format 1 EXEC(UTE) statement For further information on the use of these formats see the information on using CICS and accessing databases in your COBOL system documentation.

General Rules for Format 2

  1. The statement is compiled as a CALL "text-name" USING text-data-buffer statement (see the topic The CALL Statement), where text-data-buffer contains all the text-data from the EXEC statement (space compressed) for further parsing by the called program text-name.

    This means that the called subprogram (text-name) is passed a text string which includes the entire COBOL statement beginning with the EXEC(UTE) verb and ending with the END-EXEC phrase. The called program must parse and then process all of the included information.

    If an identifier-name is included in text-data, then it is the name of the identifier, not the value of the data in the identifier, that is passed to the subprogram.