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.
The method used for comparison is determined by the setting of the NCOLLSEQ compiler option.
If the NCOLLSEQ(BINARY) compiler option is in effect, the collating sequence is determined by the binary values of national characters. The comparison proceeds as follows:
If the NCOLLSEQ(LOCALE) compiler option is in effect, the collating sequence is determined by the runtime locale. For purposes of comparison, trailing spaces are truncated from the operands except that an operand consisting of all spaces is truncated to a single space. Locale-based comparison is not necessarily a character-by-character comparison. If the shorter operand were extended with spaces as for a nonlocale-based comparison, the result might not be the culturally-expected result. For information about locales, see Locale considerations.
The PROGRAM COLLATING SEQUENCE clause has no effect on comparisons of national operands.