pTAL Conversion Guide

Expressions
pTAL Conversion Guide527302-002
13-12
Changing the Location of the Data
Figure 13-1 on page 13-11 and Figure 13-2 on page 13-12 show that changing the
data type of a variable from INT to STRING can affect whether the address stored in
the result pointer, p, is an even-byte or odd-byte address and, therefore, how such a
change could cause your program to generate different results for TNS and native
processes.
Changing the Location of the Data
Figure 13-3 on page 13-13 is the same as Figure 13-1 on page 13-11 except that y
specifies .EXT. The IF statement, therefore, compares x to y on a byte-by-byte basis.
Because the first (upper) bytes of x and y are equal, the comparison continues to the
second byte of each variable. Because the second byte of x is “B”, but the second byte
of y is “C”, the conditional expression is false. In Figure 13-3, therefore, the IF
statement stores in p the address of the second (lower) byte of x.
Figure 13-2. Ending Address After Comparing Strings of Data Type STRING and
INT
PROC p;
BEGIN
INT x[0:1] := ["AB","CD"];
STRING y[0:1] := ["A", "C"];
STRING .p;
INT q;
IF x = y FOR 1 WORDS -> @p THEN ... ;
q := p; ! q is assigned "AB" on a TNS processor
! q is assigned "BC" on a TNS/R processor
END;
B
ABCD AC
XY
P
User Data Segment
VST012.vsd