pTAL Conversion Guide

Hardware Indicators
pTAL Conversion Guide527302-002
20-27
Using Hardware Indicators Across Procedures
Using Hardware Indicators Across Procedures
TAL
In TAL, the values of hardware indicators are always available. A TAL procedure can
set a hardware indicator—for example, a condition code—and call another procedure,
which can read the condition code set by the first procedure. pTAL does not support
this capability.
Similarly, a TAL procedure can set a hardware indicator and return to its caller. The
caller can test the value of the hardware indicator that was set by the called procedure.
In Example 20-17 on page 20-27, which is valid in TAL but not in pTAL, procedure a
sets a condition code and calls procedure b. bs action depends on the value of the
condition code.
pTAL
In pTAL, a called procedure cannot test the value of a hardware indicator that was
established in the procedure’s caller.
By explicitly setting a variable based on the value of i and passing the variable as a
parameter to b, Example 20-18 on page 20-27 does in pTAL what Example 20-17 on
page 20-27 does in TAL.
Example 20-17. Using Hardware Indicators Across Procedures (TAL)
PROC b;
BEGIN
IF <> THEN ... ! Test condition code set by a
END;
PROC a;
BEGIN
INT i, j;
...
j := i; ! Sets condition code based on value of i
CALL b; ! Call b, which tests condition code
END;
Example 20-18. Using Hardware Indicators Across Procedures
(pTAL) (page1of2)
PROC b(status);
INT status;
BEGIN
IF status <> 0 THEN ... ! Test parameter value from PROC a
END;