pTAL Guidelines for TAL Programmers
Differences Between TAL and pTAL
pTAL Guidelines for TAL Programmers—527256-002
3-27
Returning From Function Procedures
Returning From Function Procedures
In TAL, a function procedure or subprocedure that reaches the end of its code returns
a value of zero to its caller if you have not specified a DO_PTAL directive or you have
specified a DO_PTAL SYNTAX directive. If you specify DO_PTAL without the SYNTAX
option, however, your TAL program aborts if it reaches the end of its code.
In pTAL, your program aborts unconditionally if a function reaches the end of its code.
Example 3-18. ENABLE_OVERFLOW_TRAPS and
DISABLE_OVERFLOW_TRAPS Block Attributes and BEGIN-END Blocks
PROC p;
BEGIN: ENABLE_OVERFLOW_TRAPS ! Ensure traps are enabled
...
END;
PROC q;
BEGIN
SUBPROC q;
BEGIN: DISABLE_OVERFLOW_TRAPS
...
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;