HP Fortran Programmer's Reference (September 2007)

HP Fortran statements
ON (extension)
Chapter 10 407
ON (extension)
Specifies the action to take when program execution is interrupted.
Syntax
ON
interrupt-condition action
interrupt-condition
is the interrupt to be handled, either an arithmetic error or a keyboard
interrupt.
action
is one of the following:
CALL
trap-routine
ABORT
IGNORE
where:
trap-routine
is an external subroutine name.
Description
The ON statement is an HP extension. It is an executable statement that specifies the action to
be taken after the occurrence of an exception that interrupts program execution.
For each
interrupt-condition
, you can specify one of the following actions:
CALL: specifies a subroutine to be called.
ABORT: causes the program to abort.
IGNORE: causes the interrupt to be ignored.
Table 10-32 lists the range of values for
interrupt-condition
. The first column identifies
the type of trap; the second gives the keywords that must appear on the ON statement,
immediately following the word ON; and the third column gives equivalent keywords you can
specify instead of those in the second column. For example, the following ON statement causes
the program to trap an attempt to divide by zero with 8-byte floating-point operands, passing
control to a user-written trap handler called div_zero_trap: