Relational Operators

The relational operators and the operations they stand for are as follows:

Operators     Operations
= Equal
^= Not equal
> Greater than
< Less than
>= Greater than or equal to
<= Less than or equal to
^< Not less than (equivalent to >=)
^> Not greater than (equivalent to <=)
Note:

Open PL/I supports the use of a tilde (~) as an operator symbol equivalent to a caret (^).

The relational operators test the relationship of two operands. The result is always a Boolean value (a bit string of length 1). If the comparison is true, the resulting value is '1'B; if the comparison is false, the resulting value is '0'B. All relational operators are infix operators.

All operands used with relational operators must be scalar. If either operand is an arithmetic value or a pictured value, the operands are converted to a common arithmetic type as if they were operands of an add operator. If one operand is a pointer value and the other is an offset value, the offset is converted to a pointer, but only for = and ^= comparisons. In all other cases, the data types of the two operands must be equivalent.

When determining if two data types are equivalent, the ALIGNED, VARYING, RETURNS, UNALIGNED, VARIABLE, and string length attributes are ignored. Label, entry, file, and pointer data may be compared only for equality or inequality. Arithmetic and string data may be compared using any relational operator.