Comparison of Nonnumeric Operands (Relation Condition)

General Format:


 Comparison of Nonnumeric Operands

Note that the required relational characters "<" , ">", and "=" are not underlined, to avoid confusion with other symbols such as '>' (greater than or equal to).

General Rules:

  1. For nonnumeric operands, or one numeric and one nonnumeric operand, a comparison is made with respect to a specified collating sequence of characters (see the topic The Object-Computer Paragraph). If one of the operands is specified as numeric, it must be an integer data item or an integer literal and:
    1. If the nonnumeric operand is an elementary data item or a nonnumeric literal, the numeric operand is treated as though it were moved to an elementary alphanumeric data item of the same size as the numeric data item (in terms of standard data format characters), and the contents of this alphanumeric data item were then compared to the nonnumeric operand. (See the topic The MOVE Statement.)
    2. If the nonnumeric operand is a group item, the numeric operand is treated as though it were moved to a group item of the same size as the numeric data item (in terms of standard data format characters), and the contents of this group item were then compared to the nonnumeric operand. (See the topic The MOVE Statement.)
    3. A non-integer numeric operand cannot be compared to a nonnumeric operand.

    The size of an operand is the total number of standard data format characters in the operand.

  2. OSVS  Comparison of a numeric-edited data item with figurative constants is allowed and is treated as an alphanumeric comparison.
  3. MF  Numeric and nonnumeric operands can be compared when their usage is not the same. The numeric operand is treated as if it were moved to a USAGE DISPLAY item of the same size (in terms of standard data format characters), and the contents of this were then compared to the nonnumeric operand.

    There are two cases to consider:

    1. Operands of equal size - if the operands are of equal size, comparison effectively proceeds by comparing characters in corresponding character positions starting from the high order end and continuing until either a pair of unequal characters is encountered or the low order end of the operand is reached, whichever comes first. The operands are determined to be equal if all pairs of characters compare equally through the last pair, when the low order end is reached.

      The first encountered pair of unequal characters is compared to determine their relative position in the collating sequence. The operand that contains the character that is positioned higher in the collating sequence is considered to be the greater operand.

    2. 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.