OFFSET Function

── OFFSET ── ( ──<pointer expression>── ) ─────────────────────────────┤

The OFFSET function returns, as an integer value, the number of characters between the character position referenced by the pointer expression and the beginning of the array row, not including the character designated by the pointer expression. The function value is in terms of the character size of the pointer expression. If it is a word pointer, the value returned is given in terms of 8-bit characters. If the pointer expression points to a paged (segmented) array, the OFFSET function returns the total offset from the beginning of the first segment of the row.

If an uninitialized pointer is passed to the OFFSET function, the program is terminated with a fault. This fault can be trapped with an ON ANYFAULT statement or an ON INVALIDOP statement to prevent termination.

For a function that returns the number of characters between the character position referenced by a pointer expression and the end of the array row, see REMAININGCHARS Function.