In operand positions, you can access subareas of the following data objects using an offset/length specification:
- The structure contains flat character-like components only.
- The first Unicode fragment of the structure is flat and character-like, and the substring addressed by the offset and length specifications is located within this fragment.
In write positions, only flat data objects are permitted; it is not possible to write to substrings of strings.
An offset or length specification is directly appended to either the
descriptor of the data object, an
<fs> field symbol, or a dereferenced data reference variable
dref->* (only if the data reference variable is fully typed):
The segment of the data object is used that has the offset specified in
and the length (in characters or bytes) specified in
len. For an offset specification
without a length, the entire substring is addressed as of the
for a length specification without an offset, the first
len characters are
addressed (different rules apply for the
len expect data objects of
i. These data objects must contain positive integers, with the following exceptions.
- The length 0 can be specified for strings.
- A negative offset (but never length 0) can be specified if an
<fs>field symbol is specified in the
offis smaller than the length of
dobj, an asterisk (
*) can be specified for
len. The upper limit of
dobjthen determines the upper limit of the memory area.
If the prerequisites are not met or if the subarea defined by
len is not completely contained in the data object, an exception of class CX_SY_RANGE_OUT_OF_BOUNDS
off is specified as a numeric literal, then this literal cannot be prefixed with a sign.
The offset and length specifications are counted in characters for character-like data objects and in bytes for all other data objects. A character is equivalent to a byte in non- Unicode systems.
A substring specified by an offset or length specification is treated like a data object of the specified length for which the 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 substring|
The following restrictions apply:
- A memory area must not be addressed outside the field boundaries, except in the case of the
- No offset or length data can be specified if a literal or a text symbol is specified.
- In the case of dynamic operand specification in brackets, no length specifications can be made.
- If the length of the substring exactly corresponds to the length of the structure in a substring
access to a structure, the substring does not have data type
c; instead, it is handled like the structure itself.
- For read access to substrings of character-like data objects, predefined substring functions that allow you to search by substring and offset/length specifications are available.
- Obsolete syntax forms can still occur with substring access (apart from with classes).
- The statement
MOVE PERCENTAGEindicates an obsolete form of substring access.