Relational expressions

The operands in a relational expression can be arithmetic or character string expressions; they can also be logical constants and logical variables.

Only two operands can be used with each relational operator. The data type (arithmetic, character string, or logical) must be the same for the pair of operands. The result of a relational expression is a logical value '0' or '1'.

Refer to the table in Operators in expressions for the meanings of the relational operators, which can be specified by symbols (=, >, <, >=, <=, not symbol=, not symbol>, not symbol<) or their reserved values (*EQ, *GT, *LT, *GE, *LE, *NE, *NG, *NL).

If an operation involves character fields of unequal length, the shorter field is extended by blanks added to the right.

Arithmetic fields are compared algebraically; character fields are compared according to the EBCDIC collating sequence.

When logical fields are compared, a logical one ('1') is greater than logical zero ('0'). Symbolically, this is ('1' > '0').

The following are examples of relational expressions:

(&X *GT 25)
(&X > 25)
(&X>25)
 
(&NAME *EQ GSD)
(&NAME *EQ &GSD)
(&NAME *EQ 'GSD')
(&BLANK *EQ ' ')
Related reference
Operators in expressions