Data pointer relation conditions

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.

Format 2: data-pointer relation condition

Read syntax diagramSkip visual syntax diagramADDRESS OFidentifier-1identifier-2NULLNULLSISNOTEQUALTO = ADDRESS OFidentifier-3identifier-4NULLNULLS

identifier-1 , identifier-3
Can specify any level item defined in the LINKAGE SECTION, except 66 and 88.
identifier-2 , identifier-4
Must be described as USAGE POINTER.
NULL, NULLS
Can be used only if the other operand is defined as USAGE POINTER. That is, NULL=NULL is not allowed.

The following table summarizes the permissible comparisons for USAGE POINTER, NULL, and ADDRESS OF.

Table 1. Permissible comparisons for USAGE POINTER, NULL, and ADDRESS OF
 Permissible comparisons

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
Yes
Comparison allowed only for EQUAL, NOT EQUAL
No
No comparison allowed