You are on page 1of 4

Find the difference rows in one of the sources and both the sources are either flat

files or a flat file and a relational table


To illustrate this scenario, the two sources considered are two comma separated flat files -
EMPLOYEE_FILE_1.txt and EMPLOYEE_FILE_2.txt. The EMPLOYEE_FILE_2.txt has some extra
records that need to be reported or loaded into the target which is a relational table having the same
definition as the sources. The difference rows between the two flat files are highlighted in red as shown
below

Import the two flat file definitions using the Source Analyzer in Informatica PowerCenter Designer client
tool as shown below.

Create a new mapping in the Mapping Designer and drag the two source definitions into the workspace.
Now, to identify the extra records from EMPLOYEE_FILE_2, a Joiner transformation followed by a Filter
transformation is used.

The illustration discussed below uses an unsorted Joiner Transformation and since both the sources are
having few records, any one of the sources can be treated as the "Master" source. Here the
EMPLOYEE_FILE_1 source is designated as the "Master" source. In practice, however, to improve
performance for an unsorted joiner transformation, the source with fewer rows is treated as the "Master"
source while for a sorted joiner transformation, the source with fewer duplicate key values is assigned as
the "Master" source.

First drag all the ports from the source qualifier SQ_EMPLOYEE_FILE_2 into the joiner transformation.
Notice the ports created in the joiner transformation are designated as the "Detail" source by default. Drag
only the EMP_ID port from SQ_EMPLOYEE_FILE_1 into the joiner transformation as shown below.

Double-click the joiner transformation to open up the Edit view of the transformation. Click on the
Condition tab and specify the condition shown below.

Since, we need to pass all the rows from the EMPLOYEE_FILE_2, the Join Type used is "Master Outer
Join" in the Properties tab as shown below. This will ensure that all the rows from the "Detail" source and
only the matching rows from the "Master" source will pass from the joiner transformation.

The Join types supported in the joiner transformation are described below.

The rows passed by the joiner transformation are shown below. For the missing rows in the "Master"
source, the EMP_ID1 value is NULL.
Now, a filter transformation can be used ahead to pass only the records having EMP_ID1 as NULL since
these rows correspond to the difference rows from EMPLOYEE_FILE_2 source. Pass all the rows from
the joiner transformation into the filter transformation and add the Filter condition shown below in the
Properties tab of the filter transformation.

The records passed by the filter transformation are shown below.

Link the EMP_ID, EMP_NAME and CITY ports to the target definition. The complete mapping is shown
below.

Create a session task and a workflow. After running the workflow, the difference rows loaded into the
target relational table are shown below.

You might also like