HANDLE ABEND

Handle an abnormal termination exit.

Read syntax diagramSkip visual syntax diagram
HANDLE ABEND

                 .-CANCEL--------.   
>>-HANDLE ABEND--+---------------+-----------------------------><
                 +-PROGRAM(name)-+   
                 +-LABEL(label)--+   
                 '-RESET---------'   

Conditions: NOTAUTH, PGMIDERR (PROGRAM only)

This command is threadsafe.

Description

HANDLE ABEND is used to activate, cancel, or reactivate an exit for abnormal termination processing. You can suspend the command by means of the PUSH HANDLE and POP HANDLE commands as described in the CICS® Application Programming Guide.

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.
Start of changeAssemblerEnd of change
Start of changeR15: Abend label. R0-14: Contents at the point when the last EXEC CICS command was issued.End of change

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 program's resource definition.

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, note that the COMMAREA that is passed to the abend exit is the COMMAREA of the program that issued the HANDLE ABEND command. This is not necessarily the COMMAREA of the program in which the abend actually occurred.

Start of changeIf a current channel exists, it will be accessible from the specified PROGRAM.End of change

Options

CANCEL
specifies that a previously established exit at the logical level of the application program in control is to be canceled. The CANCEL option is the default setting for the HANDLE ABEND command.
LABEL(label)
specifies the program label to which control branches if abnormal termination occurs.

This option cannot be used for C or PL/I application programs.

PROGRAM(name)
specifies the name of the program to which control is to be passed if the task is terminated abnormally. If this program has not already been defined, the program will be autoinstalled in the event of the abend condition being raised.

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 to be reactivated.

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

Conditions

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

Default action: terminate the task abnormally.

PGMIDERR
RESP2 values:
1
The program has no entry in the PPT and autoinstall for programs is not active.
2
The program is disabled.
9
The installed program 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')