Trap Handling [ Compiler Library/XL Reference Manual ] MPE/iX 5.0 Documentation
Compiler Library/XL Reference Manual
Trap Handling
When an error is detected by a packed-decimal procedure, the procedure
stores information about the operation being performed, the parameters,
and the nature of the error, and then causes a trap by executing a
reserved instruction. Depending on the state of the MPE XL trap
subsystem, the trap may be ignored, the process may be aborted, a
user-written trap handler may be invoked, or a Pascal/XL recover block
may be executed.
If a trap handler is invoked and returns control to the packed-decimal
procedure, the packed-decimal procedure will immediately return to its
caller.
Under MPE XL, the ARITRAP intrinsic is used to enable or disable
arithmetic traps collectively. HPENBLTRAP is used to enable or disable
arithmetic traps selectively and XARITRAP is used to arm or disarm a
user-written trap handler. HPENBLTRAP and XARITRAP use a mask to specify
individual trap conditions. Bit (7:1) of the mask designates a "3000
Mode Packed-decimal error."
The system trap handler reacts as shown in the following table:
--------------------------------------------------------------------------------------------
| | |
| condition | action |
| | |
--------------------------------------------------------------------------------------------
| | |
| Trap disabled | Ignore trap, continue execution of process. |
| | |
--------------------------------------------------------------------------------------------
| | |
| Trap enabled, but no trap | TRY statement active: do an ESCAPE with |
| handler armed | errnum=7,subsys=200. |
| | TRY statement not active: display error message and |
| | abort process. |
| | |
--------------------------------------------------------------------------------------------
| | |
| Trap enabled and trap | Invoke user-written trap handler. |
| handler armed | |
| | |
--------------------------------------------------------------------------------------------
When control is transferred to a user-written trap handler that has been
armed with XARITRAP, the trap handler is passed a pointer to a record
containing useful information. For the format and contents of the
information record, as well as a complete description of trap handling
under MPE XL, refer to the Trap Handling Programmer's Guide.
MPE/iX 5.0 Documentation