pTAL Guidelines for TAL Programmers

Differences Between TAL and pTAL
pTAL Guidelines for TAL Programmers527256-002
3-20
Overflow Traps
Overflow Traps
In TAL, overflow traps are supported by bits in the ENV register. Using a pre-D20 TAL
compiler, you enable and disable overflow traps by executing CODE statements that
set or reset the overflow enable bit in the ENV register. You check for an overflow
condition by testing the value returned by the $OVERFLOW routine. The overflow-
enable bit in the ENV register remains unchanged throughout the execution of your
program unless you explicitly change its value.
pTAL programs that run as native processes depend on object code generated by the
native compiler to detect overflow conditions and trap if an overflow occurs. pTAL
constructs enable you to establish the overflow trapping behavior using:
Directives
Procedure attributes
BEGIN-END block attributes
Topics:
Overflow Trapping Considerations for TAL and pTAL on page 3-21
OVERFLOW_TRAPS Directive on page 3-21
OVERFLOW_TRAPS Procedure Attribute on page 3-23
ENABLE_OVERFLOW_TRAPS Block Attribute on page 3-24
Example 3-14. Array of Procedure Addresses
Declare the array of procedure pointers:
PROCPTR p(i, j);
INT i, j;
END PROCPTR;
PROCADDR pa[dev_6530:dev_conv]; ! Array of procedure addresses
Initialize the array:
pa [dev_6530] := @device_6530;
pa [dev_3270] := @device_3270;
pa [dev_conv] := @device_conv;
Select a procedure to call:
@p := pa[device_type];