HANDLE ABEND

Handle an abnormal termination exit.

HANDLE ABEND

Read syntax diagramSkip visual syntax diagramHANDLE ABENDCANCELPROGRAM( name)LABEL( label)RESET

Conditions: NOTAUTH, PGMIDERR (PROGRAM only)

This command is threadsafe.

Description

Use the HANDLE ABEND command to activate, cancel, or reactivate an exit for abnormal termination processing. You can suspend the command by using the PUSH HANDLE and POP HANDLE commands. See Using PUSH HANDLE and POP HANDLE commands.

When a task terminates abnormally, CICS® searches for an active abend exit, starting at the logical level of the application program in which the abend occurred, and proceeding to successively higher levels. The first active abend exit found, if any, is given control.

The HANDLE ABEND command cannot intercept abends that are issued with the CANCEL option. Some internal abends generated by CICS are issued with the CANCEL option, for example the ASPx or APSJ abend codes.

When the label specified in a HANDLE ABEND LABEL command receives control, the registers are set as follows:
COBOL
Control returns to the HANDLE ABEND command with the registers restored. COBOL GO TO statement is then executed.
Assembler
R15: Abend label. R0-14: Contents at the point when the last EXEC CICS command was issued at the same program level as the HANDLE ABEND command was issued.

If LABEL is specified, the addressing mode and execution key used are those of the program that issued the HANDLE ABEND command.

If PROGRAM is specified, the addressing mode is defined by the way the program is link-edited and the execution key is specified by the EXECKEY option on the resource definition of the program.

If a COMMAREA has been established, it will be passed to the specified PROGRAM. Where more than one application program was involved in the task, the COMMAREA that is passed to the abend exit is the COMMAREA of the program that issued the HANDLE ABEND command. This might not be the COMMAREA of the program in which the abend occurred.

If a current channel exists, it will be accessible from the specified PROGRAM.

Options

CANCEL
Specifies that a previously established exit at the logical level of the application program in control is canceled. This option is the default.
LABEL(label)
Specifies the program label to which control branches if abnormal termination occurs.

You cannot use this option for AMODE(64) assembler language, C, C++, or PL/I application programs.

PROGRAM(name)
Specifies the name of the program that control is passed to if the task is terminated abnormally. If the abend condition is raised and the specified program is not already defined, this program is autoinstalled.

The program named in this option should always terminate with an abend, except when handling abends generated as a result of application program logic.

RESET
Specifies that an exit canceled by a HANDLE ABEND CANCEL command, or by CICS, is reactivated.

This option is usually issued by an abnormal termination exit routine.

Conditions

70 NOTAUTH
Occurs when a resource security check has failed on PROGRAM(name).

Default action: terminate the task abnormally.

27 PGMIDERR
RESP2 values:
1
The program has no installed resource definition and autoinstall for programs is not active.
2
The program is disabled.
9
The installed program resource definition is for a remote program.

Default action: terminate the task abnormally.

Examples

The following example shows how to establish a program as an exit:
EXEC CICS HANDLE ABEND
     PROGRAM('EXITPGM')