An alphanumeric comparison is a comparison of the single-byte character values of two operands.
When one of the operands is neither class alphanumeric nor class alphabetic, that operand is processed as follows:
When the ZWB compiler option is in effect, the unsigned value of the integer operand is moved to the temporary data item. When the NOZWB compiler option is specified, the signed value is moved to the temporary data item. See the Enterprise COBOL Programming Guide for more details about the ZWB (NOZWB) compiler option.
Comparison then proceeds with the temporary data item of category alphanumeric.
Alphanumeric comparisons are made with respect to the collating sequence of the character set in use as follows:
The size of each operand is the total number of character positions in that operand; the size affects the result of the comparison. There are two cases to consider:
If all pairs of characters through the last pair evaluate as equal, the operands are equal.
If a pair of unequal characters is encountered, the characters are tested to determine their relative positions in the collating sequence. The operand that contains the character higher in the sequence is considered the greater operand.
The higher collating value is determined using the hexadecimal value of characters.