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 creates 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.

Synonym Text View

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

Synonym Text View

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

Modeling View

Refer to the sample data flow DMRCTYP 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 erties dialog box opens.

  7. If the flow reruns, you should clear the target using the Prior to Load Option. Since DMORECS is a flat file, select Delete File. Click OK.
  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 Transformation window should appear as shown in following image.

    Transformations Window

    Note that only 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. In order to preserve the precision of the value of LINEPRICE, double-click LINEPRICE in the Expressions tab, or select LINEPRICE and click the Edit Transforms button.

    The Transformation Calculator opens.

  11. Enter the calculation LINEPRICE * 100 in the expression field and click OK.
  12. Click OK to close the Transformations window.
  13. Save the data flow as DMXRCTYP.
  14. Click the Run button, and select Run from the drop-down menu.

To view the output file created by the data flow, edit the file created by the data flow. For example, on Windows, use Notepad to edit.

\ibi\apps\ibisamp\dmorecs.ftm

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

Output File


iWay Software