POINTER phrase

A data item defined with USAGE IS POINTER is a pointer data item. A pointer data item is a 4-byte elementary item or an 8-byte elementary item depending on whether the ADDR(32) or ADDR(64) compiler option is in effect.

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:

  • In a SET statement (format 5 and format 8 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.

The following table lists clauses that can or cannot be used to describe group or elementary items defined with the USAGE IS POINTER.
Table 1. Clauses that can or cannot be used with USAGE IS POINTER
Can be used with USAGE IS POINTER Cannot be used with USAGE IS POINTER
GLOBAL clause
EXTERNAL clause
OCCURS clause

LIKE clause
DATE FORMAT clause
JUSTIFIED clause
PICTURE clause
BLANK WHEN ZERO clause
TYPE clause
FORMAT clause

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

A pointer data item can be written to a file, 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 COBOL for Linux® on x86 Programming Guide.