TAL Programmer's Guide
Group Comparison Expression
Using Special Expressions
13–8 096254 Tandem Computers Incorporated
The compiler does a standard comparison and returns a 16-bit next address if:
Both var1 and var2 have standard byte addresses
Both var1 and var2 have standard word addresses
The compiler does an extended comparison (which is slightly less efficient) and
returns a 32-bit next address if:
Either var1 or var2 has a standard byte address and the other has a standard word
address
Either var1 or var2 has an extended address
Variables (including structure data items) are byte addressed or word addressed as
follows:
Byte addressed STRING simple variables
STRING arrays
Variables to which STRING simple pointers point
Variables to which STRING structure pointers point
Substructures
Word addressed INT, INT(32), FIXED, REAL(32), or REAL(64) simple variables
INT, INT(32), FIXED, REAL(32), or REAL(64) arrays
Variables to which INT, INT(32), FIXED, REAL(32), or REAL(64) simple
pointers point
Variables to which INT structure pointers point
Structures
After an element comparison, the next address might point into the middle of an
element, rather than at the beginning of the element.
You can, for example, compare the contents of two arrays and then determine from the
next address the first element that does not match:
INT .s_array[0:11] := "$SYSTEM SYSTEM MYFILE ",
.d_array[0:11] := "$SYSTEM USER MYFILE ",
.ptr,
n;
IF d_array = s_array FOR 12 –> @ptr THEN ... ;
The preceding comparison stops with element [4]; PTR contains the address of
D_ARRAY[4] shown below:
0 1 2 3 4 5 6 7 8 9 ...
$SYSTEM SYSTEM MYFILE !Content of S_ARRAY
$SYSTEM USER MYFILE !Content of D_ARRAY
To determine the number of array elements that matched, subtract the address of
D_ARRAY[0] from the address in PTR, using unsigned arithmetic:
n := @next_addr_ptr '-' @d_array;
!N gets 4 (fifth element)