# D1 D2 Conversion

Updated: 10/14/2021, 2:20:00 PM
Created: 10/14/2021, 2:20:00 PM
Last Updated By: mikes
Read Time: 2 minute(s)

# Description

Associates controlling and dependent fields. It takes the form:

D1;fmcd{;fmcd}...
D2;fmcc
1
2

where:

  • fmcd is the field number (FMC) of an associated dependent field.
  • fmcc is the field number (FMC) of the associated controlling field.

It is possible to logically group multivalued fields in a record by using a controlling multivalued field and associating other fields with it. For instance , 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.

# Note

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.

# Example

LIST INVOICE "ABC123" PARTS QTY PRICE
1

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:

INVOICE  PART QTY  PRICE
*        *
ABC123   AAA     1  10.00
BBB             11  4.00
CCC              2  3.30
1
2
3
4
5

Back to Conversion Processing