Offset data and attribute

Offset data is used exclusively with area variables. The value of an offset variable indicates the location of a based variable within an area variable relative to the start of the area.

Because the based variables are located relatively, if the area variable is assigned to a different part of main storage, the offset values remain valid.

Offset variables do not preclude the use of pointer variables within an area.

Read syntax diagramSkip visual syntax diagramOFFSET( area-variable)

The association of an area variable with an offset variable is not permanent. An offset variable can be associated with any area variable by means of the POINTER built-in function (see Locator conversion). The advantage of making such an association in a declaration is that a reference to the offset variable implies reference to the associated area variable. If no area variable is specified, the offset can be used as a locator qualifier only through use of the POINTER built-in function.