D1 D2 Conversion
Associates controlling and dependent fields.
fmcd is the field number (FMC) of an associated dependent field.
fmcc is the field number (FMC) of the associated controlling field.
You can logically group multivalued fields in a record by using a controlling multivalued field and associating other fields with it. You could, for example, group the component parts of an assembly on an invoice.
The D1 code in field 8 defines the controlling field and nominates the associated dependent fields. Each dependent field will have a D2 code in field 8.
IMPORTANT: The D1 and D2 codes must be in field 8 of the data definition record and must be the first code specified. The code can be followed by other codes (separated by a value mark), but it must be the first code.
The values in the dependent associative fields are output in the order in which they are specified in the field 8 of the controlling field. The order in which the dependent fields are specified in the output specification clause is irrelevant.
Dependent fields are marked on the output by an asterisk just below the column heading.
If the output for a controlling field is suppressed, the values in the dependent fields will also be suppressed.
The records in data file INVOICE have 3 associated, multivalued fields. The fields are named PARTS, QTY and PRICE, and numbered 7, 2 and 5 respectively.
PARTS is the controlling field because, for each multivalue in this field there will a corresponding value in the other fields, and also because PARTS should appear first on the report. The data definition record for PARTS will have D1;2;5 in field 8.
The data definition records for QTY and PRICE will both have D2;7 in field 8.
The report generated by the command will look something like this: