Abbreviated Combined Relation Conditions

When relation-conditions are written consecutively without intervening parentheses, any relation-condition after the first can be abbreviated in one of two ways:
Read syntax diagramSkip visual syntax diagram
Abbreviated Combined Relation Conditions - Format

>>-relation-condition------------------------------------------->

   .----------------------------------------------------------------.   
   V                                                                |   
>----+-AND-+--+----+--+---------+--+----------------------+--object-+-><
     '-OR--'  '-IS-'  |     (1) |  +-GREATER--+------+----+             
                      '-NOT-----'  |          '-THAN-'    |             
                                   +->--------------------+             
                                   +-LESS--+------+-------+             
                                   |       '-THAN-'       |             
                                   +-<--------------------+             
                                   +-EQUAL--+----+--------+             
                                   |        '-TO-'        |             
                                   +-=--------------------+             
                                   +-| greater or equal |-+             
                                   +->=-------------------+             
                                   +-| less or equal |----+             
                                   '-<=-------------------'             

greater or equal

|--GREATER--+------+--OR EQUAL--+----+--------------------------|
            '-THAN-'            '-TO-'   

less or equal

|--LESS--+------+--OR EQUAL--+----+-----------------------------|
         '-THAN-'            '-TO-'   

Notes:
  1. NOT GREATER THAN OR EQUAL TO, NOT >=, NOT LESS THAN OR EQUAL TO, and NOT <=, are IBM Extensions.

An object is any data item or expression that can be compared to the subject of the preceding relation condition.

In any consecutive sequence of relation-conditions, both forms of abbreviation can be specified. The abbreviated condition is evaluated as if:
  1. The last stated subject is the missing subject.
  2. The last stated relational operator is the missing relational operator.

The resulting combined condition must comply with the rules for element sequence in combined conditions, as shown in Table 1.

The word NOT is considered part of the relational operator in the forms NOT GREATER THAN, NOT >, NOT LESS THAN, NOT <, NOT EQUAL TO, and NOT =.

NOT in any other position is considered a logical operator (and thus results in a negated relation-condition).

The following examples illustrate abbreviated combined relation conditions, with and without parentheses, and their unabbreviated equivalents.

Table 1. Abbreviated Combined Relation Conditions
Abbreviated Combined Relation Condition Equivalent

A = B AND NOT < C OR D

((A = B) AND (A NOT < C))  OR (A NOT < D)
A NOT > B OR C (A NOT > B)  OR (A NOT > C)
NOT A = B OR C (NOT (A = B)) OR (A = C)
NOT (A = B OR < C) NOT ((A = 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))))