Subfield Access

In operand positions, it is possible to access a subarea of a character-type or byte-like data object or a subarea of a character-type initial part of a structure by specifying an offset or length. In write positions, this can be done only for flat data objects and not for strings.

An offset or length is appended directly to either the dobj descriptor of the data object, an fs field symbol, or a dref->* de-referencing data reference variable (since Release 6.10 and if the data reference variable is fully typed), as shown below:

dobj[+off][(len)]
[+off][(len)]
dref->*[+off][(len)]

The segment of the data object is used that has the offset specified in off and the length in characters or bytes specified in len. The off and len operands require data objects of type I, and these must contain whole positive numbers, with the following exceptions:

If off is smaller than the length of dobj, an asterisk (*) can be specified for len. The upper limit of dobj then determines the upper limit of the memory area.

A subfield that is specified by an offset or length is handled like a data object of the specified length whose data type depends on the data type of the original data object, the field symbol or the data reference variable, as shown below:

Original data type Data type of the subfield
c c
d n
n n
t n
string string
x x
xstring xstring
Structuretype c

The following restrictions apply: