COBOL Manual for TNS/E Programs (H06.08+, J06.03+)

an integer and, if a data item, to have DISPLAY usage. HP COBOL removes both of
these restrictions.
When the nonnumeric operand is either an elementary data item or a nonnumeric
literal, the numeric operand is handled as though it were moved to an elementary
alphanumeric data item, and the value of this item were then compared to the
nonnumeric operand. The size of this conceptual data item is the same as the number
of digit positions in the numeric operand. The numeric operand is handled as if it
were an unsigned integer; therefore any sign or assumed decimal point is deleted
by the conceptual move, and no COMPUTATIONAL items are converted to usage
DISPLAY.
When the nonnumeric operand is a data structure, the numeric operand is handled
as though it were moved to a data structure, and the value of this item were then
compared to the nonnumeric operand. The size of this conceptual data item is the
same as the number of character positions occupied by the numeric operand. Because
the operand is handled as if it were alphanumeric, the sign of the numeric operand
(if any) is not deleted by the conceptual move, and no COMPUTATIONAL usage
items are converted to DISPLAY usage.
Operand size
The size of an operand is the total number of characters it contains. Operands can be
of equal or unequal size.
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.
Conditional Expressions 267