Using Multiple Targets to Create a Single File With Multiple Records Types

This flow uses two targets that both point to the same flat file to write out two different record types from the HR file. There is a start record for all employees, but there is only a termination record for employees that have been terminated which is accomplished with a validate. The two different record types are designated by assigning a value to the RECTYPE field in the targets.

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

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 DMHR source from the ibisamp application directory to the left of the SQL object.
  3. Right-click the SQL object and select Column Selection.
  4. Select ID_NUM, START_DATE, TERM_DATE, STATUS, POSITION and PAYSCALE in the available columns list and click the arrow to add them to the Selected columns list. Click Ok.
  5. In the ibisamp application directory Ctrl+click DMSTART and DMTERM to select them both. Next, drag them to the right of the SQL object.

  6. Double-click DMTERM to open the Transformations window. Click the Automap button.
  7. Click the Insert Transforms button. The Transformation Calculator opens. For the name type RECTYPE, for the format type A1, and for expression type 'T'.
  8. Double-click SEVERENCE to add it to the Expressions. For the expression, enter PAYSCALE * 500.
  9. Select the Validates tab and then select Insert Transforms. The Transformation Calculator opens.
  10. Select the Expression tab and enter TERM_DATE NE MISSING. Click Ok.
  11. Click Ok.
  12. Double-click DMSTART to open the Transformations window. Select the Automap button.
  13. Select the Insert Transforms button. The Transformation Calculator opens. For the name, type RECTYPE. For the format, type A1 and for expression, type 'S'.
  14. Click OK.
  15. On the Flow tab, in the Run group, click Run and select Submit from the drop-down menu.
  16. On the Flow tab, in the Reports group, click View Last Log. Note that 223 Start records and 41 Termination records were loaded.

  17. To see the output with the two different record types in the ibisamp directory with no filter, scroll down to dmrecs - Flat File. Next, right-click dmrecs and select Edit. Scroll down to see the termination records.

iWay Software