ILE COBOL Programmer's Guide


Defining Pointers

You can define pointers in two ways:

On the AS/400 system, pointers are 16 bytes long.

ILE COBOL pointer data items point to system space objects. One part of the pointer describes its attributes, such as to which AS/400 space object it is pointing. Another part of the pointer contains the offset into the AS/400 system space object.

ILE COBOL procedure-pointer data items are AS/400 open pointers. Open pointers have the ability to be used as other types of AS/400 pointers. In particular, when an ILE COBOL procedure-pointer data item is set to a program object, the open pointer will contain an AS/400 system pointer. When an ILE COBOL procedure-pointer data item is set to an ILE procedure, the open pointer will contain an AS/400 procedure pointer.

A pointer a 16-byte elementary item that can be compared for equality, or used to set the value of other pointer items.

A pointer data item can be used only in:

A procedure-pointer data item can be used only in:

If pointers are used in a relational condition, the only valid operators are equal to, or not equal to.

Because pointer data items are not simply binary numbers on the AS/400 system, manipulating pointers as integers does not work.

Pointer data items are defined explicitly with the USAGE IS POINTER clause, and are implicit when using an ADDRESS OF special register or the ADDRESS OF an item.

If a group item is described with the USAGE IS POINTER clause, the elementary items within the group item are pointer data items. The group itself is not a pointer data item, and cannot be used in the syntax where a pointer data item is allowed. If a group item is described with the USAGE PROCEDURE-POINTER clause, the same rules apply. The USAGE clause of an elementary item cannot contradict the USAGE clause of a group to which the item belongs.

Pointers can be part of a group that is referred to in a MOVE statement or an input/output statement; however, if a pointer is part of a group, there is no conversion of pointer values to another form of internal representation when the statement is executed.

Using ILE C and other languages, you can declare pointers to teraspace memory. ILE C requires a special compile-time option to address this type of storage, but ILE COBOL can always address this storage if compiled with a target release of V4R4M0 or later. For more information on pointers in teraspace, see the ILE Concepts publication.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]