POINTER phrase

A data item defined with USAGE IS POINTER is a pointer data item, or data-pointer. A pointer data item is a 4-byte elementary item.

You can use pointer data items to accomplish limited base addressing. Pointer data items can be compared for equality or moved to other pointer items.

A pointer data item can be used only:

  • Start of changeIn an ALLOCATE statementEnd of change
  • Start of changeIn a FREE statementEnd of change
  • In a SET statement (format 5 only)
  • In a relation condition
  • In the USING phrase of a CALL statement, an ENTRY statement, or the PROCEDURE DIVISION header

Pointer data items can be part of an alphanumeric group that is referred to in a MOVE statement or an input/output statement. However, if a pointer data item is part of a group, there is no conversion of values when the statement is executed.

A pointer data item can be the subject or object of a REDEFINES clause.

SYNCHRONIZED can be used with USAGE IS POINTER to obtain efficient use of the pointer data item.

A VALUE clause for a pointer data item can contain only NULL or NULLS.

A pointer data item cannot be a conditional variable.

A pointer data item does not belong to any class or category.

Start of changeThe following table lists clauses that can or cannot be used to describe group or elementary items defined with the USAGE IS POINTER.
Can be used with the USAGE IS POINTER Cannot be used with the USAGE IS POINTER
GLOBAL clause
EXTERNAL clause
OCCURS clause
VOLATILE clause
JUSTIFIED clause
PICTURE clause
BLANK WHEN ZERO clause
End of change

Pointer data items are ignored in the processing of a CORRESPONDING phrase.

A pointer data item can be written to a data set, but upon subsequent reading of the record that contains the pointer, the address contained might no longer represent a valid pointer.

USAGE IS POINTER is implicitly specified for the ADDRESS OF special register. For more information, see Using tables (arrays) and pointers in the Enterprise COBOL Programming Guide.