Compiler Library/XL Reference Manual (32650-90029)
4- 5
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.
Parameters
The following section lists and describes the parameters used by the
packed-decimal library procedures.
operand2
Typically, the operand that receives the result of
the operation. The exception is HPPACCMPD, which
does not change either operand.
op2digs
The length of
operand2
in digits.
operand1
The other operand. As shown in the calling
sequences,
operand2
is given before
operand1
, except
in the case of HPPACCMPD.
op1digs
The length of
operand1
in digits.
source
The sending field in a conversion to or from
external-decimal or binary.