TAL Programmer's Guide

Group Comparison Expression
Using Special Expressions
13–6 096254 Tandem Computers Incorporated
Comparing a Variable
to a Variable
To compare a variable to another variable, include the FOR clause in the group
comparison expression. In the FOR clause, specify a count value—a positive INT
arithmetic expression that specifies the number of bytes, words, or elements you want
to compare.
Comparing Bytes
To compare bytes regardless of the data type of var2, specify the BYTES keyword
following the count value in the FOR clause of the group comparison expression.
BYTES compares the number of bytes specified by the count value. If both var1 and
var2 have word addresses, however, BYTES generates a word comparison for
(count + 1) / 2 words.
For example, you can compare bytes between INT arrays:
LITERAL length = 12; !Number of array
! elements
INT word_array_one[0:length - 1]; !
var1
INT word_array_two[0:length - 1]; !
var2
INT byte_count; !
count
value (number
! of bytes to compare)
!Code to assign values to variables
IF word_array_one = word_array_two
FOR byte_count BYTES THEN ... ;
Comparing Words
To compare words regardless of the data type of var2, specify the WORDS keyword
following the count value in the FOR clause of the group comparison expression.
WORDS compares the number of words specified by the count value.
For example, to compare words instead of doublewords between INT(32) arrays,
multiply LENGTH by 2 and include the WORDS keyword:
LITERAL length = 12; !
count
value (number
!of words to compare)
INT(32) dblw_array_one[0:length - 1]; !
var1
INT(32) dblw_array_two[0:length - 1]; !
var2
!Code to assign values to arrays
IF dblw_array_one[0] = dblw_array_two[0]
FOR 2 * length WORDS THEN ... ;