COBOL Manual for TNS and TNS/R Programs
Procedure Division
HP COBOL Manual for TNS and TNS/R Programs—522555-006
8-65
Complex Conditions
Combined Conditions
condition
is a simple or complex condition.
As Table 8-18 shows, you can use the element pair OR NOT, but you cannot use the
pair NOT OR. Also, you can use NOT, but you cannot use NOT NOT. Within the
combined condition, parentheses must always be in balanced pairs, so that each left
parenthesis precedes its corresponding right parenthesis.
These combined conditions are valid:
Table 8-18. Conditions, Logical Operators, and Parentheses
Element
Location in
Conditional
Expression In a left-to-right sequence of elements
First Last
When not first, element
can be immediately
preceded only by
When not last, element can
be immediately followed only
by
simple-
condition
Yes Yes AND, NOT, OR, ( AND, OR, )
AND or OR No No simple-condition, ) NOT, (, simple-condition
NOT Yes No AND, OR, ( (, simple-condition
( Yes No AND, NOT, OR, ( NOT, (, simple-condition
)NoYessimple-condition, ) AND, OR, )
LARRY AND MOE AND (CURLY OR SHEMP)
All four are condition-names—
level-number 88.
I < E AND (E NOT > C)
All three symbols are alphanumeric
data items.
NOT ((A IS POSITIVE) OR (B IS POSITIVE))
Both A and B are numeric data
items.
condition
AND
OR
condition
VST123.vsd