Creating a Target File With Multiple RECTYPEs

Instead of loading a target, you can also use DataMigrator to extract data from a data source and create input files for a packaged application that requires RECTYPEs indicating different record layouts.

DataMigrator can create a flat file containing the different record layouts. This requires a data flow that loads a sequential file with a previously defined layout. The synonym for the sequential file contains one segment for each RECTYPE, along with all the associated columns. The RECTYPE identifies the type of record in the ALIAS. Each segment has a unique value for RECTYPE.

The following example uses a single synonym with multiple segments to create a flat file containing two RECTYPEs. DMORD, an orders table, is the data source. Extracted records are loaded into one sequential file data target, DMORECS, which contains two segments.

The first segment contains the header information, indicated by a RECTYPE of 'H', and includes the columns ORDER_DATE, STORE_CODE, and PLANT.

Segment example

The second segment contains the detail information, indicated by a RECTYPE of 'D', and includes the columns PROD_NUM, QUANTITY, and LINEPRICE.

Rectype example

The graphical view of the DMORECS synonym shows how the two segments are related. OINFO contains the header records; PINFO contains the detail records.

Graphical view

Refer to the sample data flow ORECS for the complete example.


Top of page

Example: Creating a Flat File With Different Record Layouts

In the DMC:

  1. Right-click an application directory and select New, then Flow. The Data Flow tab opens in the workspace, with the SQL object displayed.
  2. Drag the DMORD data source object from the ibisamp application directory in the navigation pane into the workspace, to the left of the SQL object.
  3. Right-click the SQL object and select Column Selection.

    The Column Selection window opens.

  4. Select ORDER_NUM, ORDER_DATE, STORE_CODE, PLANT, PROD_NUM, QUANTITY, and LINEPRICE in the Available Columns list and click the arrow to add them to the Selected Columns list. Click OK.
  5. Drag the DMORECS data target object from the ibisamp application directory into the workspace, to the right of the SQL object.
  6. Right-click DMORECS, and select Properties.

    The Properties dialog box opens.

  7. If the flow will be rerun, you should clear the target using the Prior to Load Option. Since DMORECS is a flat file, select Delete File. Click X to close the Properties panel.
  8. Right-click DMORECS, and select Target Transformations.

    The Transformation window opens.

  9. To map the source columns to the data target, click the AutoMap button.

    The Transformations window opens, as shown in the following image.

    Transformations window

    Note that the RECTYPE columns remain unmapped. The RECTYPE values are assigned automatically at load time based on the value given for the RECTYPE in the synonym, in this case, H or D.

  10. Save the data flow as DMXRCTYP.
  11. On the Flow tab, in the Run group, click Run and select Submit from the drop-down menu.

To view the output file created by the data, ensure that the No Filter button is selected in the Browser. Expand the baseapp directory and scroll down past the list of synonyms. There you will see a filename of dmorecs with a type of flat file. Double-click it to open it.

Note that the output file contains records with two different layouts.


iWay Software