Relation Condition

A relation condition causes a comparison of two operands, each of which can be the data item referenced by an identifier, a literal or the value resulting from an arithmetic expression. A relation condition has a truth value of "true" if the relation exists between the operands. Comparison of two numeric operands is permitted regardless of the formats specified in their respective USAGE clauses. However, for all other comparisons the operands must have the same usage. If either of the operands is a group item, the nonnumeric comparison rules apply.

OSVSVSC2 A nonnumeric literal can be enclosed in parentheses.

OSVS Note that " = TO", "> THAN" and "< THAN" are accepted.

OSVSMF THEN may be used instead of THAN.

The first operand (identifier-1, literal-1 or arithmetic-expression-1) is called the subject of the condition; the second operand (identifier-2 or literal-2 or arithmetic-expression-2) is called the object of the condition. The relation condition must contain at least one reference to a variable.

The relational operator specifies the type of comparison to be made in a relation condition. A space must precede and follow each reserved word comprising the relational operator. When used, "NOT" and the next key word or relation character are one relational operator that defines the comparison to be executed for truth value; for example, "NOT EQUAL" is a truth test for an "unequal" comparison; " NOT GREATER" is a truth test for an "equal" or "less" comparison. The meaning of the relational operators is shown in the Relational Operators table below.

The following relational operators are equivalent:

IS EQUAL TO and EQUALS;
IS NOT EQUAL TO and IS UNEQUAL TO;
IS GREATER THAN and EXCEEDS;
IS NOT GREATER THAN and IS LESS THAN OR EQUAL TO;
IS NOT LESS THAN and IS GREATER THAN OR EQUAL TO.
Table 1. Relational Operators
Meaning Relational Operator
Greater than or not greater than  
Syntax for Greater than or not greater than relational operator
Less than or not less than  
Syntax for Less than or not less than relational operator
Equal or not equal to  
Syntax for Equal or not equal to relational operator
Greater than or equal to  
Syntax for Greater than or equal to relational operator
Less than or equal to  
Syntax for Less than or equal to relational operator
Equal to  
Syntax for Equal to relational operator
Not equal to  
Syntax for Not equal to relational operator
Greater than  
Syntax for Greater than relational operator

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