Modify the offset value for a layout
When you are using a template to format your data, there are times when the information in your segments is displaced because your copybook or template defines its fields as beginning to the right or left of the actual data in the segment. For example, your segments may include header information, which is not defined in the copybook structure, or your copybook may include a definition for some header information which is not in the actual data. (PL/I copybooks are sometimes coded with a 4 byte RDW field that File Manager strips from the segment, as it isn't normally considered part of the data.) To map your template to your segments without changing the originating copybook, you can specify an offset value, which changes the template's field starting positions to the left or right.
The offset value is an integer between -32760 and 32760, which is applied to one or more Level 01 fields in the template. The starting position of each field within the Level 01 segment layout is increased or decreased by this value. A positive offset moves the fields to the right and some fields might be mapped beyond the length of the segment. Data that falls beyond the length of the segment layout is not represented. You cannot edit a field where the data you supply would fall beyond the physical end of the layout (whether the record is of fixed or variable length). A negative offset moves the fields to the left and all fields with a resultant zero or negative start location are removed from the display.
All required fields must have a positive start location. Required fields are fields such as OCCURS DEPENDING ON target fields, PL/I REFER fields, or fields referenced in segment identification or field selection criteria. If a required field would have a negative or zero start column value under the supplied offset, the offset is invalid, and thus not allowed. If the first element of a dimensioned field is at a zero or negative start location, that field (all array elements) is removed from the display.
The offset is applied before values are calculated for use in identification or selection criteria.
When you are editing a template, you can enter an offset value in the Template : Segment Layout panel to change the starting position of the currently displayed segment type. If the template contains more than one Level 01 field, you can use the OFFSET primary command in the Template : Segment Layout Selection panel to change one or more Level 01 fields.
To change the offset in a single segment type:
- In the Template : Segment Layout panel, enter a
positive or negative number, between -32760 and
32760, in the Offset field.
The offset value is added to the segment length of the Level 01 field and to the starting position of all fields within the segment layout.
To change the offset in multiple segment layouts:
- In Command line on the Template : Segment
Layout Selection panel, enter the OFFSET primary
command and the offset value.
By default, the offset value is applied to all segment layouts with a current offset value of zero. To apply the offset value to all segment types in the template, regardless of the current offset value, use the ALL keyword with the primary command. To apply the offset value to a specific segment layout, specify the layout name with the primary command.
The offset value is added to the segment length of the Level 01 field and to the starting position of all fields within the specified segment layouts.
Related topics