pTAL Reference Manual (G06.24+, H06.09+, J06.03+)
After an element comparison, next-addr might point into the middle of an element, rather than
to the beginning of the element, because next-addr always refers to the first byte or 16-bit word
(as appropriate) that differs.
Example 15 (page 92) compares two arrays and then tests the condition code setting to see if the
value of the element in d_array that stopped the comparison is less than the value of the
corresponding element in s_array.
Example 15 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
When you compare array elements (as in Example 15 (page 92)), 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 16 (page 92).
Example 16 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 17 (page 92) contrasts a comparison to a bracketed (single-byte) constant with a
comparison to an unbracketed (element) constant.
Example 17 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
Bit Operations
You can access individual bits or groups of bits in a STRING or INT variable.
92 Expressions