+-------------------------------IBM Extension--------------------------------+
A data item defined with the USAGE IS POINTER clause is a pointer data item.
A pointer data item is a 16-byte elementary item that can be used to accomplish base addressing. Pointer data items can be compared for equality, or moved to other pointer items.
A pointer data item may only be used in:
The USAGE IS POINTER clause may be written at any level except 66 or 88.
If a group item is described with the USAGE IS POINTER clause, the elementary items within the group are pointer data items. The group itself, however, is not a pointer data item and cannot be used in the syntax where a pointer data item is allowed.
Pointer data items can be part of a group that is referred to in a MOVE statement or an I/O statement. If, however, a pointer data item is part of a group, there is no conversion of pointer values to another internal representation when the statement runs.
A pointer data item can be the subject or object of a REDEFINES clause.
A VALUE clause for a pointer data item can contain NULL or NULLS only.
A pointer data item does not belong to a class or category, and it cannot be used as a conditional variable.
The JUSTIFIED, PICTURE, SIGN, TYPE, BLANK WHEN ZERO, and FORMAT clauses cannot be used to describe group or elementary items defined with the USAGE IS POINTER clause.
Pointer data items are ignored in CORRESPONDING operations.
A pointer data item can be written to a file, but if you later read the record containing the pointer data item, the item will no longer represent a valid address.
USAGE IS POINTER is implicitly
specified for the ADDRESS OF special register.
You cannot treat ILE COBOL pointer data items as ordinary numbers.
Related Information:
For the purposes of this section on pointer alignment, the term pointer refers to both pointer data items and procedure-pointer data items.
When a pointer is referenced, or is the subject of a REDEFINES clause, the object item must be in alignment. In other words, it must be located at an offset that is a multiple of 16 bytes from the beginning of the record.
A data item described as a pointer in the Working-Storage, Local-Storage or File sections is aligned. If the pointer is part of a structure that begins at level-number 01, the compiler aligns the beginning of the structure. After that, the compiler puts FILLER items in front of the pointer to make sure that it is also in alignment. The compiler issues a warning when it adds these FILLER items.
In the Linkage section:
If a pointer is the subject of a REDEFINES clause in the Linkage section, and the object of the clause is not a pointer, you will receive a warning that you need to maintain pointer alignment. For the same situation in the Working-Storage, Local-Storage or File sections, an error will result if you do not align the object of the clause.
You can specify the SYNCHRONIZED clause along with USAGE IS POINTER or USAGE IS PROCEDURE-POINTER clause, but this clause is already implicit for pointers.
If the pointer is part of a table, the first item in the table is aligned, and to make sure that all occurrences of the pointer are also aligned, a filler item might be added to the end of the table.
To avoid adding FILLER items to data structures, place pointers at the beginning of the structures.
+----------------------------End of IBM Extension----------------------------+
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.