Terminating preinitialized COBOL environment

Use the following interface to terminate the preinitialized persistent COBOL environment.

About this task

CALL term_routine syntax

Read syntax diagramSkip visual syntax diagramCALLterm_routine( function_code, error_code)
CALL
Invocation of term_routine, using language elements appropriate to the language from which the call is made
term_routine
The name of the termination routine: _iwzCOBOLTerm or IWZCOBOLTERM
function_code (input)
A 4-byte binary number, passed by value. function_code can be:
1
Clean up the preinitialized COBOL runtime environment as if a COBOL STOP RUN statement were performed; for example, all COBOL files are closed. However, the control returns to the caller of this service.
error_code (output)
A 4-byte binary number. error_code can be:
0
Termination was successful.
1
Termination failed.

The first COBOL program called after the invocation of the preinitialization routine is treated as a subprogram. Thus a GOBACK from this (initial) program does not trigger run-unit termination semantics such as the closing of files. Run-unit termination (such as with STOP RUN) does free the preinitialized COBOL environment before the invocation of the run-unit exit routine.

COBOL environment not active: If your program invokes the termination routine and the COBOL environment is not already active, the invocation has no effect on execution, and control is returned to the invoker with an error code of 0.

Example: preinitializing the COBOL environment