pTAL Conversion Guide

Hardware Indicators
pTAL Conversion Guide527302-002
20-7
ENABLE_OVERFLOW_TRAPS Block Attribute
The TAL compiler generates code to enable or disable overflow traps at the end of any
BEGIN-END block that specifies an overflow traps block attribute and whose
encompassing block has the opposite overflow traps value. If no encompassing block
specifies an overflow traps value, the current value of the OVERFLOW_TRAPS
compiler directive determines the state of overflows upon leaving the block.
TAL and pTAL support block overflow trapping attributes; therefore, a pTAL procedure
that specifies block attributes has the same trapping behavior In TNS and native
processes, although this is not necessarily the case for procedures called from within
the block.
For TNS and native processes, the ENABLE_OVERFLOW_TRAPS and
DISABLE_OVERFLOW_TRAPS block attributes establish the trapping state of a block,
regardless of the trapping state of a procedure’s or subprocedure’s caller or of the
code surrounding the block.
Example 20-3. ENABLE_OVERFLOW_TRAPS Block Attribute (TAL Only)
?OVERFLOW_TRAPS ! Enable traps
PROC p;
BEGIN:DISABLE_OVERFLOW_TRAPS ! Disable traps
IF i = j THEN
BEGIN: ENABLE_OVERFLOW_TRAPS ! Enable traps
...
END ! Traps are disabled
ELSE
BEGIN ! Traps remain disabled
...
END
END;
Example 20-4. ENABLE_OVERFLOW_TRAPS Block Attribute (page 1 of 2)
PROC p;
BEGIN: ENABLE_OVERFLOW_TRAPS ! Ensure that traps are enabled
...
END;
PROC q;
BEGIN
SUBPROC q1;
BEGIN: DISABLE_OVERFLOW_TRAPS
...
END;
...
END;
PROC r;
BEGIN: ENABLE_OVERFLOW_TRAPS
CALL p; ! Call p with traps enabled
END;