COBOL Manual for TNS/E Programs (H06.03+)
Procedure Division
HP COBOL Manual for TNS/E Programs—520347-003
8-68
Condition Evaluation Rules
•
NOT as Modifier or Operator
The reserved word NOT in an abbreviated combined relation condition is
interpreted as a part of the relational operator if the word immediately following
NOT is GREATER, >, LESS, <, EQUAL, or =; otherwise, NOT is interpreted as a
logical operator, and the implied insertion of a subject or relational operator results
in a negated relation condition.
Some examples of abbreviated combined and negated relation conditions and
expanded equivalents follow:
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.
Abbreviated Combined Relation
Condition Expanded Equivalent
A > B AND NOT < C OR D ((A > B) AND (A NOT < C)) OR (A NOT < D)
A NOT EQUAL B OR C (A NOT EQUAL B) OR (A NOT EQUAL C)
NOT (A GREATER B OR < C) NOT ((A GREATER B) OR (A < 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










