When a pointer data item or procedure-pointer data item is passed in a CALL statement, the item is treated as all other USING items. In other words, when a pointer data item is passed BY REFERENCE (or BY CONTENT), a pointer to the pointer data item (or copy of the pointer data item) is passed to the called program. When a pointer data item is passed BY VALUE the contents of the pointer data item is placed on the call stack. Procedure-pointer data items are passed similarly.
Special consideration must be given when a CALL statement with the BY CONTENT phrase is used to pass pointers and group items containing pointers. This is similar to the case of a MOVE statement. For a CALL...BY CONTENT, an implicit MOVE of an item is done to create it in a temporary area. To ensure pointer alignment on this pointer MOVE, the ILE COBOL compiler or run time must determine the offset of the BY CONTENT item relative to the 16-byte boundary. For the best performance, the BY CONTENT item should be coded in such a way that the ILE COBOL compiler can determine this offset.
The ILE COBOL run time has to determine the offset of an item relative to a 16-byte boundary when the BY CONTENT item is:
When an operand is reference-modified, the offset is the reference modification starting position minus one, plus the operand's offset within the data structure. When an operand is in the Linkage Section, its offset can be determined from the calling program.
To avoid pointer alignment problems, pass items using BY REFERENCE.
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.