── POINTER ── ( ─┬─<array row>────────────┬────────────────────────────►
├─<subscripted variable>─┤
└─<string literal>───────┘
►─┬─────────────────────────┬─ ) ──────────────────────────────────────┤
└─ , ─┬─<character size>──┤
└─<pointer primary>─┘<character size>
──┬─ 0 ─┬──────────────────────────────────────────────────────────────┤ ├─ 4 ─┤ ├─ 7 ─┤ └─ 8 ─┘
The POINTER function generates a pointer to the specified location.
If the first parameter is an array row, the pointer references the first character of the first word of the specified array row. If the first parameter is a subscripted variable, the pointer references the first character of the array element specified by the subscripted variable. The <string literal> is stored in the constant pool. If the last character of the string literal is not already the null character (4"00"), a null character is appended to it implicitly.
If the second parameter is not given, the character size of the pointer is 8 bits, depending on the default character type. For more information on the default character type, refer to Default Character Type.
If the second parameter is a character size of 4 or 8, the character size of the pointer being generated is 4 bits or 8 bits, respectively. If the second parameter is a character size of 7, the character size of the pointer is 8 bits. If the second parameter is a character size of 0, the pointer is word-oriented, rather than character-oriented. In addition, the pointer is single-precision if the array it points to is single-precision (INTEGER, REAL, or BOOLEAN), and the pointer is double-precision if the array is double-precision (COMPLEX, DINTEGER, or DOUBLE).
If a pointer primary is given as the second parameter, the character size of that pointer primary is used for the character size of the pointer being generated.
Examples of the POINTER Function
BEGIN ARRAY A1,A2[0:9]; POINTER P1,P2,P3,P4,P5; P1 := POINTER(A1); P2 := POINTER(A1[9]); P3 := POINTER(A1,4); P4 := POINTER(A2[6],P3); END.
Execution of this program has the following results:
|
P1 |
This pointer has a character size of 8 bits (the default character type is EBCDIC when P1 is assigned) and points to the first 8-bit character of the first element of array A1. |
|
P2 |
This pointer has a character size of 8 bits and points to the first 8-bit character of element 9 of array A1. |
|
P3 |
This pointer has a character size of 4 bits and points to the first 4-bit character of the first element of array A1. |
|
P4 |
This pointer has a character size of 4 bits and points to the first 4-bit character of element 6 of array A2. |

