pTAL Conversion Guide

Expressions
pTAL Conversion Guide527302-002
13-11
Changing the Data Type of the Data
Topics:
Changing the Data Type of the Data on page 13-11
Changing the Location of the Data on page 13-12
Changing the Data Type of the Data
In TAL and pTAL, you can compare two strings using a group comparison expression,
and save the address where the comparison stopped in a variable or pointer. In
Figure 13-1 on page 13-11, the IF statement compares x to y on a word-by-word basis.
Because the 16 bits in x are not equal to the 16 bits in y, the conditional expression is
false, and P points to the beginning of string x.
Figure 13-2 on page 13-12 is the same as Figure 13-1 on page 13-11 except that in
Figure 13-2, y is a two-byte STRING array. 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. Because the second byte of x is “B”, but the
second byte of y is “C”, the conditional expression is false. In Figure 13-2, therefore,
the IF statement stores in p the address of the second (lower) byte of x.
Figure 13-1. Ending Address After Comparing INT Strings in the User Data
Segment
PROC p;
BEGIN
INT x[0:1] := ["AB","CD"];
INT y := "AX";
INT .p;
IF x = y FOR 1 WORDS -> @p THEN ... ;
q := p; ! q is assigned "AB" on TNS and TNS/R processors
END;
B
ABCD AX
XY
P
User Data Segment
VST010.vsd