pTAL Reference Manual (H06.03+)
Expressions
HP pTAL Reference Manual—523746-005
5-30
Group Comparison
When you compare array elements (as in Example 5-5 on page 5-30), the ELEMENTS
keyword is optional but provides clearer source code.
To compare structure or substructure occurrences, you must specify the ELEMENTS
keyword in the group comparison expression, as in Example 5-6 on page 5-30.
Example 5-7 on page 5-30 contrasts a comparison to a bracketed (single-byte)
constant with a comparison to an unbracketed (element) constant.
Example 5-5. Array Comparison
INT d_array[0:9];
INT s_array[0:9];
! Code to assign values to arrays
IF d_array = s_array FOR 10 ELEMENTS -> @pointer THEN
BEGIN ! They matched
! Do something
END
ELSE
IF < THEN ... ; ! Pointer points to element of d_array
! Do something else that is less than the corresponding
! element of s_array
Example 5-6. Structure Comparison
STRUCT struct_one [0:9];
BEGIN
INT a[0:2];
INT b[0:7];
STRING c;
END;
STRUCT struct_two (struct_one) [0:9];
! Code here to assign values to structures
IF struct_one = struct_two FOR 10 ELEMENTS THEN ... ;
Example 5-7. Constant Comparison
STRING var[0:1];
...
IF var = [0] THEN ... ; ! Compare var[0] to one byte
IF var = 0 THEN ... ; ! Compare var[0:1] to two bytes or
! one 16-bit word










