5-28 Command Reference
COMPARE
Purpose Compares the contents of two fields.
Syntax COMPARE
buffer-field1
,
modifier
,
buffer-field2
[ , [
invalid label
] [
, valid label
] ]
Process The COMPARE command compares the two buffer fields, based on
modifier
.
Modifier
can be one of the following:
Modifier
Description
GT Greater than operator
GE Greater than or equal to operator
LT Less than operator
LE Less than or equal to operator
EQ Equal to operator
The
buffer-field
fields can be one of the following:
Buffer-field1
and
2
Description
INPUT Input Buffer
Logical Field Name
(TEMP1)
Temporary Buffer
Field
Logical Field Name (LU1) Lookup Buffer Field
Logical Field Name (PR1) Printer Buffer Field
Logical Field Name
(Field1) [Index]
Array Buffer Field
String
Number
ASCII string delimited
by double quotes
A number prefixed by
the number sign (#)
Rule: B
uffer-field1
and
buffer-field2
must be the same type. For example, if
buffer-field1
is numeric,
buffer-field2
must also be numeric.
Optional Fields
Invalid
and
valid labels
are discussed in “Script Flow" at the beginning of this
chapter.
Rules: If the comparison is true, control passes to
valid label
or to the next line if there is
no
valid label
.
If the comparison is false, control passes to
invalid label
or to the next line if there
is no
invalid label
.
Example
This example compares TEMP1 and TRUCK_ID for equality. If they are equal,
control passes to *TRUCK_IN. If they are not equal, control passes to *JUMP_5.
COMPARE TEMP1,EQ,TRUCK_ID,*JUMP_5,*TRUCK_IN