Abend Services
During the execution of an application, a serious error may be detected by CMS, or the application itself. These errors start abnormal termination (abend) processing. CMS provides facilities for the application to request abends and to attempt to recover from any abends that do occur.
An abend occurs on a thread when it requests abnormal termination with the AbnormalEnd function, when CMS detects an unrecoverable error performing one of its services, or the thread receives a program check. In any of these cases, CMS lets the application try to recover from the error and continue execution. If the abend is not handled successfully by the application, the application process is abnormally ended and its child processes are deleted. All abend notification and recovery facilities are provided by means of event signaling and monitoring. See Event Management for more information on event handling.
To inform error handlers that an abend has occurred, CMS defines the VMERROR event, which it signals to activate and control error recovery. An error handler is defined by the application by creating an event monitor for the VMERROR event, and an event trap routine can handle the error. Multiple monitors can be defined for the event and the error handlers associated with these monitors are run in LIFO order.
If a process does not handle the error, an additional error event named VMERRORCHILD is signaled in the ancestor processes of the abending process to allow further recovery attempts or first failure data capture by these processes for the abending process.
The data presented to an error handler by the VMERROR event is given in the following structure. It is defined in VMCABN H, VMASMABN MACRO, and VMREXABN COPY.
| Hex | Dec | Type | Len | Name | Description |
|---|---|---|---|---|---|
| 00 | 0 | Signed | 4 | vm_errorcode | Error completion code |
| 04 | 4 | Signed | 4 | vm_errortype | Error type - system/user |
| 08 | 8 | Signed | 4 | vm_errthread_id | Abending program's thread ID |
| 0C | 12 | Character | 8 | vm_errpgm_name | Program name for SVC level |
| 14 | 20 | Address | 4 | vm_errmod_data_ptr | Pointer to modifiable data area |
| 18 | 24 | Signed | 4 | vm_errmod_data_len | Length of modifiable data |
| 1C | 28 | Address | 4 | vm_error_cmssdwa | Pointer to CMS System Diagnostic Work Area |
| 1C | 28 | Signed | 4 | vm_errorprocess_id | Abending program's process ID |
The values of the error type field are represented by the constants vm_abn_type_user and vm_abn_type_system for user abends and system abends, respectively. Vm_error_cmssdwa points to the CMS System Diagnostic Work Area, which is mapped by CMSSDWA and contains additional abend information.
The modifiable data area (pointed to from displacement X'14' of the error data) has the following format:
| Hex | Dec | Type | Len | Name | Description |
|---|---|---|---|---|---|
| 00 | 0 | Signed | 64 | vm_errgprs[16] | General registers 0-15 at time of abend |
| 40 | 64 | Signed | 32 | vm_errfprs[4] | Floating point registers 0,2,4, and 6 at time of abend |
| 60 | 96 | Address | 4 | vm_err_rtepaw | Runtime environment anchor for process owning abending thread |
| 64 | 100 | Address | 4 | vm_err_rtetaw | Runtime environment anchor for abending thread |
| 68 | 104 | Character | 24 | - | Unused |
| 80 | 128 | Signed | 64 | vm_erraccregs[16] | Access registers 0-15 at time of abend |
| C0 | 192 | Address | 4 | vm_errpsw | PSW address at time of abend |
| C4 | 196 | Address | 4 | vm_erretry_ptr | Amode ANY retry address or 0 |
| C8 | 200 | Signed | 4 | vm_errnext_inst | Next Sequential Instruction indicator |
| CC | 204 | Address | 4 | vm_erruserdata_ptr | Pointer to optional user data (from AbnormanEnd call) |
| D0 | 208 | Signed | 4 | vm_erruserdata_len | Length of optional user data (from AbnormalEnd call) |