Compare Stage in Datastage

Compare Stage in Datastage

The Compare stage in DataStage allows comparing the records column-wise in two data sets.These two data sets must be presorted. It supports two input link and one output link.

Example

Table 1. First data set

bcol0 bcol1 bcol2 bcol3 bcol4
0 0 0 0 aa
1 7 1 1 bb
2 2 2 2 cc
3 3 3 3 dd
4 5 4 4 ee
5 2 5 5 ff
6 6 6 6 gg
7 7 7 7 hh
8 8 8 8 ii
9 9 9 9 jjj

This is the second data set:

Table 2. Second data set

bcol0 bcol1 bcol2 bcol3 bcol4
0 0 0 0 aa
1 1 1 1 bb
2 2 2 2 cc
3 3 3 3 dd
4 4 4 4 ee
5 5 5 5 ff
6 6 6 6 gg
7 7 7 7 hh
8 8 8 8 ii
9 9 9 9 jj

The stage compares on the Key columns bcol1 and bcol4. This is the output data set:

Output data set:

Result First Second
bcol0 bcol1 bcol2 bcol3 bcol4 bcol0 bcol1 bcol2 bcol3 bcol4
0 0 0 0 0 aa 0 0 0 0 aa
2 1 7 1 1 bb 1 1 1 1 bb
0 2 2 2 2 cc 2 2 2 2 cc
0 3 3 3 3 dd 3 3 3 3 dd
2 4 5 4 4 ee 4 4 4 4 ee
-1 5 2 5 5 ff 5 5 5 5 ff
0 6 6 6 6 gg 6 6 6 6 gg
0 7 7 7 7 hh 7 7 7 7 hh
0 8 8 8 8 ii 8 8 8 8 ii
0 9 9 9 9 jj 9 9 9 9 jj

 

Difference between change capture and difference stage in DataStage

The Difference stage is similar to the Change Capture stage The Change Capture stage is designated to be used in combination with the Change Apply stage (Change Apply stage);.

The Difference stage outputs the before and after rows to the output data set, plus a code indicating if there are differences.

Share this post

Leave a Reply