Copying with the default field mapping
A field mapping between “From” and “To” templates could be generated as:
Given an input data set that consists of three records (one of each type defined in the “From” template), like
this:
├─ FIELD-A1 ─┼─ FIELD-A2 ─┼─ FIELD-A3 ─┤◄─ REC-TYPE-A
├─ FIELD-B1 ─┼─ FIELD-B2 ─┤ ◄─ REC-TYPE-B
├─ FIELD-C1 ─┼─ FIELD-C2 ─┤ ◄─ REC-TYPE-C
then copying the input data set would result in an output data set like this:
├─ FIELD-A1 ─┼─ FIELD-A2 ─┤ ◄─ NEW-TYPE-A ❷
├─ FIELD-B1 ─┼─ FIELD-B2 ─┼─ FIELD-B3 ─┤◄─ NEW-TYPE-B ❸
├─ FIELD-C1 ─┼─ FIELD-C2 ─┤ ◄─ REC-TYPE-C ❹
Notes:
- ❶
- File Manager pairs record types by matching field names within the record types; the names of the record types (level-01 group items, in the copybooks) are not important.
- ❷
- There is no matching FIELD-A3 in the “To” template NEW-TYPE-A, so this field is not copied to the output data set.
- ❸
- There is no FIELD-B3 in the “From” template to map to this FIELD-B3 in the “To” template. The field is inserted in the output data set; its value is initialized according to the field create attributes (if they exist) in the “To” template, or to zero (if it is a numeric field) or blanks (if it is an alphanumeric field).
- ❹
- There is no record type in the “To” template containing fields named FIELD-C1 or FIELD-C2, so the REC-TYPE-C record type in the “From” template is not paired with any record type in the “To” template (even though the “To” template contains a record type named REC-TYPE-C). The REC-TYPE-C record from the input data set is copied intact to the output data set. To stop this record from being copied, you need to edit the “From” template and deselect the REC-TYPE-C record type.
- ❺
- The REC-TYPE-C record type definition in the “To” template is unused, and has no effect on the copy.