A national comparison is a comparison of the national character value of two operands of class national.
When the relation condition specifies an operand that is not class national, that operand is converted to a data item of category national before the comparison. The following list describes the conversion of operands to category national.
A national floating-point item is treated as though it were a data item of category national, rather than as a numeric value.
The implicit moves for the conversions are carried out in accordance with the rules of the MOVE statement.
The resulting category national data item is used in the comparison of two national operands.
If the operands are of unequal length, the comparison proceeds as though the shorter operand were padded on the right with the default national space character (NX'0020') to make the operands of equal length. The comparison then proceeds according to the rules for the comparison of operands of equal length.
If the operands are of equal length, the comparison proceeds by comparing corresponding national character positions in the two operands, starting from the leftmost position, until either unequal national characters are encountered or the rightmost national character position is reached, whichever comes first. The operands are determined to be equal if all corresponding national characters are equal.
The first-encountered unequal national character in the operands is compared to determine the relation of the operands. The operand that contains the national character with the higher collating value is the greater operand.
The higher collating value is determined using the hexadecimal value of characters.
The PROGRAM COLLATING SEQUENCE clause has no effect on comparisons of national operands.