pTAL Guidelines for TAL Programmers
Coding Guidelines
pTAL Guidelines for TAL Programmers—527256-002
2-8
Equivalenced Variables and Memory
Equivalenced Variables and Memory
Guideline: Equivalenced variables can reference only the memory contained within
the previous variable.
In TAL, an equivalenced variable declaration can reference data outside of the memory
allocated for the previous variable, for example by using indexing.
In pTAL, the equivalenced variable declaration can reference data only within the
memory allocated for the previous variable.
The following declaration is valid in TAL but not in pTAL, because j references not only
the 16 bits in i, but also the next 16 bits:
INT i;
INT(32) j = i;
Example 2-5. Zero in Next Field of Structure Ensures That Scan Stops
STRUCT .s;
BEGIN
STRING scan_buff [0:79]; ! Buffer for scanning stopper
STRING stopper; ! immediately follows buffer
END;
s.stopper := 0;
SCAN s.scan_buff WHILE " "; ! If line is blank,
! zero in s.stopper stops scan