pTAL Reference Manual (H06.08+)
Expressions
HP pTAL Reference Manual—523746-006
5-27
Group Comparison
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 Section 3, Data
Representation.
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 on page 5-27
•
Testing Group Comparisons on page 5-29
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 5-2 on page 5-27 and Figure 5-3 on page 5-28 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 5-2 on page 5-27, 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 5-2. Ending Address After Comparing INT Strings (page 1 of 2)
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;










