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:
- Right-click an application directory and select New, then Flow.
The Data Flow tab opens in the workspace, with the SQL object displayed.
- Drag the DMHR source from the ibisamp application directory
to the left of the SQL object.
- Right-click the SQL object and select Column Selection.
- 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.
- In the ibisamp application directory Ctrl+click DMSTART and DMTERM to
select them both. Next, drag them to the right of the SQL object.
- Double-click DMTERM to open the Transformations window.
Click the Automap button.
- Click the Insert Transforms button. The
Transformation Calculator opens. For the name type RECTYPE, for
the format type A1, and for expression type 'T'.
- Double-click SEVERENCE to add it to the
Expressions. For the expression, enter PAYSCALE * 500.
- Select the Validates tab and then select Insert Transforms.
The Transformation Calculator opens.
- Select the Expression tab and enter TERM_DATE NE MISSING. Click Ok.
- Click Ok.
- Double-click DMSTART to open the Transformations window.
Select the Automap button.
- Select the Insert Transforms button.
The Transformation Calculator opens. For the name, type RECTYPE.
For the format, type A1 and for expression, type 'S'.
- Click OK.
- On the Flow tab, in the Run group, click Run and
select Submit from the drop-down menu.
- On the Flow tab, in the Reports group, click View
Last Log. Note that 223 Start records and 41 Termination
records were loaded.
- 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.