TAL Programmer's Guide

Group Comparison Expression
Using Special Expressions
096254 Tandem Computers Incorporated 13–5
Group Comparison
Expression
The group comparison expression compares a variable with another variable or with a
constant. In general, to use a group comparison expression, specify these items:
A variable (var1) with or without an index
var1 can be a simple variable, array, simple pointer, structure, structure data item,
or structure pointer, but not a read-only array.
A relational operator. All comparisons are unsigned regardless of whether you
use a signed or unsigned relational operator. Relational operators are:
Signed: <, =, >, <=, >=, <>
Unsigned: '<', '=', '>', '<=', '>=', '<>'
An item to which to compare var1. The item can be one of:
A variable (var2)—a simple variable, array, read-only array, simple pointer,
structure, structure data item, or structure pointer—followed by the FOR
clause
A constant—a number, a character string, or a LITERAL
A constant list
Group comparison expressions often appear in IF statements:
IF var_1 <> 0 FOR n BYTES THEN ... ;
Comparing a Variable
to a Constant List
To compare an array (but not a read-only array) to a constant list, specify the constant
list on the right side of the group comparison expression:
STRING array[0:3];
!Some code here
IF array = [ "ABCD" ] THEN ... ;
!Compare ARRAY to constant list
Comparing a Variable
to a Single Byte
To compare a variable to a single byte, enclose a single constant in brackets ([ ]) on the
right side of the group comparison expression. If the variable has a byte address or is
a STRING structure pointer, the system compares a single byte regardless of the size of
the constant:
STRING var[0:1];
!Some code here
IF var[0] = [5] THEN ... ; !Compare VAR to a single byte
In the preceding example, if you do not enclose the constant 5 in brackets (or if VAR
has a word address or is an INT structure pointer), the system compares a word,
doubleword, or quadrupleword as appropriate for the size of the constant. The
following example shows the preceding IF statement with brackets omitted:
IF var[0] = 5 THEN ... ; !Compare VAR to two bytes