pTAL Conversion Guide

Statements
pTAL Conversion Guide527302-002
15-11
DO-UNTIL Statement
DO-UNTIL Statement
In pTAL, the conditional expression in a DO-UNTIL statement cannot reference
hardware indicators—only IF statements can test hardware indicators. For more
information, see Section 20, Hardware Indicators.
Example 15-13 on page 15-11 is valid in TAL but not in pTAL.
To use a hardware indicator’s value to control a DO-UNTIL loop, save the hardware
indicator’s value, and test the saved value or execute an explicit GOTO statement to
exit the loop. Example 15-14 on page 15-11 saves the hardware indicator’s value, and
tests the saved value in the DO-WHILE control expression.
Example 15-15 on page 15-11 uses a GOTO statement to exit the DO-UNTIL loop.
Example 15-13. DO-UNTIL Statement With Condition Code (TAL)
DO
BEGIN
...
READ(...);
END
UNTIL <>; ! Condition code is invalid in UNTIL clause
Example 15-14. DO-UNTIL Statement With Condition Code (pTAL)
INT exit_loop;
...
exit_loop := FALSE;
DO
BEGIN
...
READ(...);
IF <> THEN exit_loop := TRUE;
END
UNTIL exit_loop;
Example 15-15. DO-UNTIL Statement With GOTO Statement
DO
BEGIN
...
READ(...);
IF <> THEN GOTO out;
END
UNTIL false;
out:
...