pTAL Guidelines for TAL Programmers
Coding Guidelines
pTAL Guidelines for TAL Programmers—527256-002
2-46
Hardware Indicators: Testing in a Called Procedure
Hardware Indicators: Testing in a Called Procedure
Guideline: Do not set a hardware indicator and test the indicator in a subsequently
called procedure.
In TAL, you can set a hardware indicator in a procedure and reference the indicator’s
value in a called procedure, as in Example 2-58
on page 2-47.
Example 2-56. Valid $OVERFLOW Test (pTAL)
?NOOVERFLOW_TRAPS ! Disable overflow traps
temp := i + 1;
IF $OVERFLOW THEN ! Test for overflow
BEGIN
! Handle overflow condition
END
ELSE
BEGIN
i := i + 1; ! Reestablish cond code and do assignment
IF <> THEN ... ! OK
END;
?OVERFLOW_TRAPS ! Enable overflow traps
Example 2-57. Valid $CARRY Test
temp := i '+' 1;
IF NOT > THEN
BEGIN
i := i '+' 1;
IF $CARRY THEN ...
...
END
ELSE
BEGIN
i := temp; ! Which must equal zero
END;