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.

Only one abend exit can be active at any given logical level within a task. This means that:
  1. When one program LINKs to another program, the LINKed-from program and the LINKed-to program can each have one active exit.
  2. 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.

When an abend request is issued for a task, CICS® immediately passes control to the exit that is active at the current logical level:
  • 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.

After any program-level abend exit code has been executed, the next action depends on how the exit code ends:
  • 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:
    1. Dynamic transaction backout is not performed.
    2. An end-of-task syncpoint record is written to the system log.
Note: If a transaction updates recoverable resources and, therefore, requires transaction backout to be performed in the event of a task abend, the exit code must end with an ABEND command to preserve data integrity. If your exit code returns to CICS without an ABEND command, CICS gives control to the next higher logical level as described above, transaction backout is not performed, and changes to recoverable resources are committed.


dfht2c00140.html | Timestamp icon Last updated: Monday, 5 June 2017