HP 3000 Manuals

Trap Handling [ HP Transact Documentation Update Notice ] MPE/iX 5.5 Documentation


HP Transact Documentation Update Notice

Trap Handling 
[REV BEG]

Traps occur when Transact encounters specific arithmetic errors, Pascal
library errors, or a control-y is issued.  When an arithmetic trap is
discovered in a Transact program, an error is issued and processing
stops.  Transact does not always process traps in the same way depending
on whether they occur in the main program, a called subprogram, an Inform
system, or an ACI subprogram.  The different types of processing for
Transact trap handling are described below.

Trap handling can also be modified by specifically calling the trap
intrinsics via the PROC verb.

System Initialization 

Arithmetic traps are armed and enabled during initialization of a
Transact program.  ARITRAP and XARITRAP are called to enable and arm the
arithmetic traps.  Control-y traps are also enabled during initialization
by issuing the XCONTRAP intrinsic.  For Transact/iX, the Pascal library
traps are set by calling XLIBTRAP.

PROC 

When calling a subprogram (other than a Transact subprogram) using the
PROC call, you can select the TRAP or NOTRAP option.  If no option is
selected, the default TRAP option is used.  When the TRAP option is used,
any arithmetic or library traps that occur in the subprogram result in an
error message.  The subprogram terminates, and control is returned to the
main program.  If NOTRAP is specified in the PROC statement, all
arithmetic traps are ignored in the subprogram, and processing continues
as if no problems occurred.  No status or information is passed back to
the main program with either option.  Online and batch modes are
processed in the same way.

CALL 

When calling a Transact subprogram, arithmetic traps and control-y are
not disabled.  Trap handling in the main program is the same throughout
the Transact subprogram.  In batch mode, the called subprogram issues an
error message and terminates.  Control is returned to the main program
and processing continues.

When calling an Inform or Report program, control-y is first disabled
then re-enabled after the Inform or Report program completes.  Arithmetic
traps are not enabled or disabled.  The arithmetic trap that is set at
the time of the call is used throughout the Inform or Report program.

ACI 

When the Architected Call Interface (ACI) intrinsic TL_CALL_TRANSACT is
used to call a Transact subprogram from another language, the main
program's arithmetic trap handling is saved, then re-enabled before
returning to the main program.  The Transact subprogram enables
arithmetic and library traps during initialization.  HPENBLTRAP is called
to enable arithmetic traps, then XARITRAP is called to arm them.
XLIBTRAP is called to arm the library traps.  For more information about
ACI see Appendix D.

LET 

The LET verb has two modes for handling errors.  The default mode is
automatic, and occurs when the error message is displayed and processing
continues to the next statement.  The other mode, error branching, occurs
when an error branch is specified in the LET statement.  When certain
errors are encountered, control is transferred to the error branch, and
no error message is displayed.  When the default mode is used in batch
mode, an error on the LET verb will cause the program to terminate.  For
more information see the LET verb in Chapter 8.

IF, REPEAT, WHILE 

When an arithmetic error occurs in the IF, REPEAT, or WHILE statements,
an error message is displayed, and processing continues to the next
statement.  In batch mode, the error causes the program to stop.  For
more information see the IF, REPEAT, or WHILE statements in Chapter
8.[REV END]



MPE/iX 5.5 Documentation