pTAL Reference Manual (G06.24+, H06.09+, J06.03+)
constant-list
is a list of one or more constants, which are concatenated and compared to var-1. Specify
constant-list in the form shown in Chapter 3 (page 46).
next-addr
is a variable to contain the address of the first byte or word in var-1 that does not match the
corresponding byte or word in var-2. The compiler returns a 16-bit or 32-bit address as
described in the following subsection.
pTAL programs access all data using byte addresses. pTAL uses the low-order bit of addresses;
therefore, when you use an odd-byte address to access a 16-bit word that you have declared with
.EXT, you access the data beginning at the odd-byte address.
You can use group comparisons for:
• Changing the Data Type of the Data (page 90)
• Testing Group Comparisons (page 91)
Changing the Data Type of the Data
You can compare two strings using a group comparison expression, and save the address where
the comparison stopped in a variable or pointer.
Figure 2 (page 90) and Figure 3 (page 91) 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.
In Figure 2 (page 90), 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 2 Ending Address After Comparing INT Strings
PROC p;
BEGIN
INT x[0:1] := ["AB","CD"]
INT y := "AX";
INT .p;
INT q;
IF x = y FOR 1 WORDS -> @p THEN ... ;
q := p; ! Assign "AB" to q
END;
Figure 3 (page 91) is the same as Figure 2 (page 90) except that in Figure 3 (page 91), y is a
2-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 3 (page 91), therefore, the IF statement stores in p the address of the second
(lower) byte of x.
90 Expressions