Comparing two class national operands

You can compare the character values of two operands of class national.

Either operand (or both) can be any of the following types of items:

  • A national group
  • An elementary category national or national-edited data item
  • A numeric-edited data item that has USAGE NATIONAL

One of the operands can instead be a national literal or a national intrinsic function.

When you compare two class national operands that have the same length, they are determined to be equal if all pairs of the corresponding characters are equal. Otherwise, comparison of the binary values of the first pair of unequal characters determines the operand with the larger binary value.

When you compare operands that have unequal lengths, the shorter operand is treated as if it were padded on the right with default UTF-16 space characters (NX'0020') to the length of the longer operand.

The PROGRAM COLLATING SEQUENCE clause does not affect the comparison of two class national operands.

related concepts  
National groups

related tasks  
Using national groups

related references  
National comparisons (Enterprise COBOL for z/OS® Language Reference)