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

Some examples of abbreviated combined and negated relation conditions and expanded equivalents
follow:
Expanded EquivalentAbbreviated Combined Relation Condition
((A > B) AND (A NOT < C)) OR (A NOT < D)A > B AND NOT < C OR D
(A NOT EQUAL B) OR (A NOT EQUAL C)A NOT EQUAL B OR C
NOT ((A GREATER B) OR (A < C))NOT (A GREATER B OR < C)
NOT (A NOT > B AND C AND NOT D) NOT ((((A NOT > B) AND (A NOT > C)) AND
(NOT (A NOT > D))))
(A + B - C) > D AND NOT < E OR F (A + B - C) > D AND (A + B - C) NOT < E OR
(A + B - C) NOT < F
Condition Evaluation Rules
Parentheses can be used to specify the order in which individual conditions are to be evaluated
when it is necessary to depart from the implied evaluation precedence. Conditions within parentheses
are evaluated first. Within nested parentheses, evaluation proceeds from the least inclusive condition
to the most inclusive condition. When parentheses are not used, or parenthetical conditions are
at the same level of inclusiveness, this hierarchical order of logical evaluation is implied until the
final truth value is determined:
Values are established for arithmetic expressions.
Truth values for simple conditions are established in this order:
Relation
Class
Condition-name
Switch-status
Sign
Truth values for negated simple conditions are established.
Truth values for combined conditions are established, first by applying the AND logical
operators, then by applying the OR logical operators.
Truth values for negated combined conditions are established.
When the sequence of evaluation is not completely specified by parentheses, the order of
evaluation of consecutive operations of the same hierarchical level is from left to right.
Using this order of evaluation, once a truth value for an entire complex condition is established,
evaluation of the condition ceases. For example, in the complex condition
A NOT < 1 AND A NOT > 10 AND B (A) > 5
no attempt is made to fetch B(A) if A is not a valid subscript, because determination that the first
condition is FALSE guarantees that the complete complex condition is FALSE.
Concatenation Expressions
The value of a concatenation expression is the concatenation of the value of its operands. It is the
equivalent of a literal of the same class and value, and can be used anywhere that a literal of that
class can be used, except in a COPY or REPLACE statement.
276 Procedure Division