Only EQUAL and NOT EQUAL are allowed as relational operators when specifying pointer data items. Pointer data items are items defined explicitly as USAGE POINTER, or are ADDRESS OF special registers, which are implicitly defined as USAGE POINTER.
The operands are equal if the two addresses used in the comparison would both result in the same storage location.
This relation condition is allowed in IF, PERFORM, EVALUATE, and SEARCH format-1 statements. It is not allowed in SEARCH format-2 (SEARCH ALL) statements because there is no meaningful ordering that can be applied to pointer data items.
The following table summarizes the permissible comparisons for USAGE POINTER, NULL, and ADDRESS OF.
| USAGE POINTER
second operand |
ADDRESS OF
second operand |
NULL or NULLS
second operand |
|
|---|---|---|---|
| USAGE POINTER
first operand |
Yes | Yes | Yes |
| ADDRESS OF
first operand |
Yes | Yes | Yes |
| NULL/NULLS
first operand |
Yes | Yes | No |
|
|||