<< Click to Display Table of Contents >> Navigation: User guide > Logic > Relational tests |
Relational tests compare the values of two variables, using one of the six relational operators:
.EQ. equal to
.GT. greater than
.LT. less than
.NE. not equal to
.LE. less than or equal to
.GE. greater than or equal or
The following relational tests are allowed (where relop is one of the above):
col.relop.col code comparison (only .EQ. and .NE. allowed)
col.relop.cvar character comparison
col.relop.literal character comparison
field.relop.field code comparison (only .EQ. and .NE. allowed)
field.relop.svar numeric comparison
field.relop.ivar numeric comparison
field.relop.wvar numeric comparison
field.relop.cvar character comparison
field.relop.cell numeric comparison
field.relop.literal character comparison
field.relop.iconstant numeric comparison
svar.relop.svar numeric comparison
svar.relop.field numeric comparison
svar.relop.ivar numeric comparison
svar.relop.wvar numeric comparison
svar.relop.cell numeric comparison
svar.relop.bit numeric comparison
ivar.relop.svar numeric comparison
ivar.relop.field numeric comparison
ivar.relop.ivar numeric comparison
ivar.relop.wvar numeric comparison
ivar.relop.cell numeric comparison
ivar.relop.iconstant numeric comparison
wvar.relop.svar numeric comparison
wvar.relop.field numeric comparison
wvar.relop.ivar numeric comparison
wvar.relop.wvar numeric comparison
wvar.relop.cell numeric comparison
wvar.relop.wconstant numeric comparison
cvar.relop.col character comparison
cvar.relop.field character comparison
cvar.relop.cvar character comparison
cvar.relop.literal character comparison
cell.relop.svar numeric comparison
cell.relop.field numeric comparison
cell.relop.ivar numeric comparison
cell.relop.wvar numeric comparison
cell.relop.cell numeric comparison
cell.relop.wconstant numeric comparison
mvar.relop.mvar bit comparison (only .EQ. and NE. allowed)
In field.relop. the field is treated as an ivar if it is less than 10 columns wide, otherwise it is treated as a wvar.
The entities in character comparisons must be of equal length.
Relational operators LT, GT, LE and GE when used in character comparisons use system functions to compare according to the ASCII collating sequence in use on the computer.
IMPORTANT: U (undefined) is in fact a very large negative number.
Only relational operators EQ and NE are allowed in code comparisons and mvar comparisons. Variables are equal if the same bits (and only those bits) are set in both variables. For mvars only the variables may be different lengths but they will only be equal if all the additional bits are empty.
NOTE: an svar with no bits set is treated as having a value of zero.
Examples of relational tests:
$123.ne.$124,
$1245.eq.'A',
$123-125.ge.20,
$9171-9173.ne.'MRS',
$s1.gt.$s2,
$m1.ne.$m2,
$i1.eq.$i2,
$wtest.le.15.5,
$cp1.eq.'T1',
#23(r0,c0).gt.0.0,