pTAL Conversion Guide

Statements
pTAL Conversion Guide527302-002
15-27
WHILE Statement
See the TAL Reference Manual and TAL Programmer’s Guide for specific information
on optimized FOR loops.
Although pTAL manages USE variables as it does INT variables, as in TAL, pTAL
reports a syntax error if you apply an @ operator to a USE variable.
Avoid USE variables. In performance-critical portions of your code, however, you might
use a USE variable to optimize program performance of TNS processes, while
maintaining the same functionality in native processes.
If you execute a DROP statement, a subsequent USE statement does not access the
same information as the previous DROP.
WHILE Statement
In pTAL, the conditional expression in a WHILE statement cannot reference hardware
indicators—only IF statements can test hardware indicators. For more information, see
Section 20, Hardware Indicators.
To use a hardware indicator to control whether to continue executing a WHILE
statement, save the hardware indicator’s value or execute an explicit GOTO statement.
Example 15-39. Invalid Use of @ Operator (pTAL)
! TAL code
USE i;
INT j;
j := @i; ! pTAL reports syntax error
! Equivalent pTAL code
USE i;
WADDR j;
j := @i; ! pTAL reports syntax error
Example 15-40. WHILE Statement With Hardware Indicator (TAL)
WHILE < DO ! ERROR: < is a hardware indicator
BEGIN
...
READ(...);
END;