COBOL Manual for TNS and TNS/R Programs
Procedure Division
HP COBOL Manual for TNS and TNS/R Programs—522555-006
8-56
Simple Conditions
°
Operands of equal size
If the operands are of equal size, the process compares characters in
corresponding character positions, starting with the leftmost character
position and continuing until it either encounters a pair of unequal
characters or exhausts the operands. The process determines that the
operands are equal if all character pairs in the operands are equal;
otherwise, the process compares the first pair of unequal characters it
encounters to determine their relative position in the collating sequence
active for the comparison. The operand that contains the character that has
a higher position in the collating sequence is considered to be the greater
operand.
°
Operands of unequal size
If the operands are of unequal size, comparison proceeds as though the
shorter operand were extended on the right by sufficient spaces to make
the operands of equal size.
•
Index-Name and Index Data Item Comparisons
Relation tests can be made between these operands:
°
Two index-names
The result is the same as if the corresponding occurrence numbers were
compared.
°
An index-name and a numeric data item or numeric literal
The occurrence number that corresponds to the value of the index-name is
compared to the value of the data item or literal.
°
An index data item and an index-name or another index data item
The actual values are compared without conversion.
Neither an index-name nor an index data item can be compared with any operand
other than those mentioned in the preceding rules.
•
National Data Items and National Literals
A national data item or a national literal can be compared only to another national
data item or a national literal.
The first three simple relation conditions in Example 8-11 are equivalent.