Handling abends and program level abend exits
You can write program-level abend exit code so that the program proceeds differently, depending on the abend that occurs.
- Record application-dependent information that relates to that task, in case the task terminates
abnormally.
If you want to initiate a dump, do this in the exit code at the same program level as the abend. If you initiate the dump at a higher program level than where the abend occurred, you might lose valuable diagnostic information.
- Attempt local recovery, and then continue to run the program.
- Send a message to the terminal operator. For example, you might do this if you think that the cause of the abend is bad input data.
Information available to a program-level exit routine or program
The following table shows information that the ASSIGN commands provide to a program-level exit routine or program.
| Command | Information provided |
|---|---|
| ADDRESS TWA | The address of the transaction work area (TWA) |
| ASSIGN ABCODE | The current CICS® abend code |
| ASSIGN ABOFFSET | The offset of the latest ASRA, ASRB, or ASRD abend |
| ASSIGN ABPROGRAM | The name of the failing program for the latest abend |
| ASSIGN ASRAINTRPT | The instruction length code (ILC) and program interrupt code (PIC) data for the latest AICA, ASRA, ASRB, ASRD or ASRE abend |
| ASSIGN ASRAKEY | The execution key at the time of the last AEYD, AEYF, AICA, ASRA, or ASRB abend, if any |
| ASSIGN ASRAPSW | The program status word (PSW) for the latest AICA, ASRA, ASRB, ASRD or ASRE abend |
| ASSIGN ASRAPSW16 | The 16 byte PSW for the latest AICA, ASRA, ASRB, ASRD or ASRE abend |
| ASSIGN ASRAREGS | The general-purpose registers for the latest AICA, ASRA, ASRB, ASRD or ASRE abend |
| ASSIGN ASRAREGS64 | The 64-bit general-purpose registers for the latest AICA, ASRA, ASRB, ASRD or ASRE abend |
| ASSIGN ASRASPC | The type of space in control at the time of the last AEYD, AEYF, AICA, ASRA, or ASRB abend, if any |
| ASSIGN ASRASTG | The type of storage being addressed at the time of the last AEYD, AEYF, AICA, ASRA, or ASRB abend, if any |
| ASSIGN ORGABCODE | Original abend code in cases of repeated abends |
Considerations
If an abend occurs during the invocation of a CICS service, issuing a further request for the same service might cause unpredictable results, because the reinitialization of pointers and work areas, and the freeing of storage areas in the exit routine, might not be completed. In addition, ASPx abends, which are task abends while in syncpoint processing, cannot be handled by an application program.
For transactions that are to be dynamically backed out if an abend occurs, beware of writing exit code that ends with a RETURN command. This would indicate to CICS that the transaction had ended normally and would therefore prevent dynamic transaction backout and automatic transaction restart where applicable.
Exit programs can be coded in any supported language, but exit routines must be in the same language as the program of which they are a part.
Learn more
For the transaction abend codes for abnormal terminations that CICS initiates, their meanings, and the recommended actions, see Transaction abend codes.
For programming information relating to the coding of program-level exit code (such as addressability and use of registers), see Creating a program-level abend program or routine . For background information, see Abnormal termination recovery.