COBOL Manual for TNS/E Programs (H06.08+, J06.03+)

Usage Considerations:
Terminology
In the preceding syntax diagrams, the left-hand operand is called the subject of the condition;
the right-hand operand is called the object of the condition.
Where Pointer Relations Are Allowed
A relation with pointer operands is allowed in EVALUATE, IF, PERFORM, and SEARCH
VARYING statements. It is not allowed in SEARCH ALL statements, because pointer data items
have no meaningful order.
Cannot Compare Literal With Literal
At least one nonpointer operand must be an index-name, identifier, or arithmetic expression
containing at least one reference to a data item; that is, the relation must include at least one
nonliteral element.
Operators
The relational operators specify the type of comparison to be made in the relation condition,
as this table shows. NOT and the component following it are considered to be a single
relational operator. For example, NOT EQUAL is a truth test for an unequal comparison. In
this table, optional words are in brackets.
Relational Operator
MeaningSymbolWords
Greater than>GREATER [THAN]
Not greater thanNOT >NOT GREATER [THAN]
Less than<LESS [THAN]
Not less thanNOT <NOT LESS [THAN]
Equal to=EQUAL [TO]
Not equal toNOT =NOT EQUAL [TO]
Greater than or equal to>=GREATER [THAN] OR EQUAL [TO]
Less than or equal to<=LESS [THAN] OR EQUAL [TO]
Numeric Comparisons
Numeric comparisons are made with respect to the algebraic values of the operands. The
number of digits present in the representation of an operand is not significant. Comparison
of numeric operands is permitted regardless of the manner in which their usage is described.
Unsigned numeric operands are considered positive for purposes of comparison. Zero is
considered a unique value regardless of its sign.
Nonnumeric Comparisons
For nonnumeric operands, or one numeric and one nonnumeric operand, a comparison is
made with respect to the program collating sequence (see OBJECT-COMPUTER Paragraph
(page 102)).
One operand is numeric:
The numeric operand must be a numeric literal or a reference to a numeric data item;
therefore, it cannot be an arithmetic expression. COBOL requires the operand to be
266 Procedure Division