pTAL Reference Manual (G06.24+, H06.09+, J06.03+)
Example 193 OVERFLOW_TRAPS Compiler Directive and Procedure Attribute
?OVERFLOW_TRAPS ! Enable traps
PROC x NOOVERFLOW_TRAPS; ! Disable traps for x
BEGIN
...
END;
PROC y; ! Traps for y are still enabled
BEGIN
...
END;
PROC z NOOVERFLOW_TRAPS; ! Disable traps for z
BEGIN
SUBPROC s OVERFLOW_TRAPS; ! Enable traps for s
BEGIN
...
END;
...
s;
... ! Traps for z are still disabled
END; ! upon return from s
[EN|DIS]ABLE_OVERFLOW_TRAPS Block Attribute
The ENABLE_OVERFLOW_TRAPS and DISABLE_OVERFLOW_TRAPS block attributes establish the
trapping state of a block, regardless of the trapping state of the procedure’s or subprocedure’s
caller or of the code surrounding the block.
Example 194 ENABLE_OVERFLOW_TRAPS and DISABLE_OVERFLOW_TRAPS Block Attributes
PROC p;
BEGIN: ENABLE_OVERFLOW_TRAPS ! Enable traps for block
...
END;
PROC q;
BEGIN
SUBPROC q1;
BEGIN: DISABLE_OVERFLOW_TRAPS ! Disable traps for block
...
END;
...
END;
PROC r;
BEGIN: ENABLE_OVERFLOW_TRAPS
CALL p; ! Call p with traps enabled
END;
PROC s;
BEGIN: DISABLE_OVERFLOW_TRAPS
CALL p; ! Call p with traps disabled
END;
Managing Overflow Traps 235