ABEXIT Function

Note:
This function can only be used with programs written in Assembler.

The ABEXIT function enables an application program to set up a routine which will get control in the event of the program abending. This can be used to clean up reserved resources, to provide an application specific message to users of the application and/or to enable the application to continue processing if desired.

The exit routine will receive control in the same context as it was set up. This means that the registers are saved at the point where the exit is set up and the user exit given control with these same registers if an abend occurs. If the ABEXIT function was issued in 31 bit mode, or the exit is a 31 bit address, the exit will get control in 31 bit mode. It will get control in the key in which the thread is in at the time of the abend.

If another abend occurs while the exit has control, the exit will not get control a second time and the application program will be abended. An exit is deemed to be in control until the point that it successfully issues another API request.

An abend exit can also be used as an end-of-job exit routine. If you specify the EOJ parameter on the ABEXIT function call, then this abend exit routine will also receive control when Com-plete terminates the application normally. To distinguish between an abend call and an end-of-job call, the exit routine can analyze the contents field ABXDCODE (abend code), which will contain zero at an end-of-job call.

The format for the ABEXIT function is:

ABEXIT ( retcode , exit address , ABXD [,eoj] )
retcode A fullword containing the return code after Com-plete has processed the appropriate function.
exit address This is the address of the exit routine to get control in the event of an abend. If this field is zero, any previously set abend exit routine will be reset.
ABXD This is the address of the user supplied abend exit data area as mapped by the copybook CCABXD. This parameter is required if the request is to set an abend exit. Refer to the copybook itself for details of the contents which are filled out when an abend occurs. This parameter must be supplied for both set and reset requests.
Return Codes
0 Abend exit set successfully set or reset
4 Exit replaced a previously set exit for a set request. No previous exit set for a reset request
8 Insufficient thread storage to process request
12 Invalid parameters passed to the ABEXIT function
Abends

Abends may occur if the exit address and/or the ABXD address are invalid.