Exit code
Exit code can be written either in programs (separate modules defined in the CSD) or in routines within the application program. Exit code, if activated, can gain control when a task abend occurs.
Exit code can be activated, deactivated, or reactivated by HANDLE ABEND commands. For information about HANDLE ABEND commands, see CICS command summary.
- When one program LINKs to another program, the LINKed-from program and the LINKed-to program can each have one active exit.
- When an exit is activated (at a particular program level), any other exit that may already be active at the same level automatically becomes deactivated.
Reasons that an application programmer might have for coding a program level abend exit, and functions that might be incorporated, are discussed in Handling abends and program level abend exits.
- If no exit is active at the current logical level, CICS checks progressively up through higher logical levels and passes control to the first exit code found to be active.
- If CICS finds no active exit at, or higher than, the current logical level, the task terminates abnormally (see Abnormal termination of a task).
When control is transferred to any exit code, CICS deactivates the exit before any of its code is executed. (This means that, in the event of another abend request, the exit will not be reentered, and control is passed to activated exit code (if any) at the next higher level.)
The exit code then executes as an extension of the abending task, and runs at the same level as the program that issued the HANDLE ABEND command that activated the exit.
- If the exit code ends with an ABEND command, CICS gives control to the next higher level exit code that is active. If no exit code is active at higher logical levels, CICS terminates the task abnormally. The next topic describes what may happen after abnormal termination of a task.
- If the exit code ends with a RETURN command, CICS returns
control to the next higher logical level at the point following the
LINK command (not to any exit code that may be active) just as if
the RETURN had been issued by the lower level application program.
This leaves the task in a normal processing state, and it does not terminate
at this point. In the special case of a RETURN command being issued by exit code at the highest logical level, CICS regains control and terminates the task normally. This means that:
- Dynamic transaction backout is not performed.
- An end-of-task syncpoint record is written to the system log.