Substring Field Entries

New field Assign a new field name to the field being constructed. This must be unique and obey normal field naming conventions.

Description This must be entered and will appear on other screens showing the file description when an AFD is active. Hence it will help identify the nature and content of the field.

Source Field The name of the existing field from which the new field is to be defined. A substring field can only be extracted from a single field name which is already part of the standard file description. F4 can be used to select a field name and once selected, F14 can be used to view the contents of the data field.

Start The start position of the new field within the existing field.

Len Length of the substring portion of the data. This refers to the new field length and so if creating a new packed field from an existing alpha field, the length refers to the unpacked data length, not the number of bytes occupied by the alpha field version.

Decs Decimal places of the new field, only valid for alpha source fields being overridden to numeric fields.

Type O/r Field type override is only valid for new fields based on alpha source fields, and must be packed (P) or zoned (S). The field on the file must contain valid data appropriate to the new sub-string field.

Example 1 To sub-string a new field called ‘month’ from an existing field with the picture YYYYMMDD, the start position would be 5 and the length 2.

Example 2 To create a packed field definition (example value 12345.67+) from the middle of a 17 long alpha field that contains valid packed data:-

Position 12345678901234567
Translation AAAAA BBB12345
Digit 11111246F22212345

Start       6
Len         7
Decimals    2
Type O/r    P