DATASTAGE SCENARIO BASED QUESTION – 1 : MULTIPLE OUTPUTS SOLUTION WITH CDC STAGE

MULTIPLE-OUTPUTS-SOLUTION-CDC-STAGE
Question:
Input-1:
1
2
3
4
5
6
Input-2:
4
5
6
7
8
9
Output-1:
1
2
3
Output-2:
4
5
6
Output-3:
7
8
9
Solution:
This problem can be solved by using no of ways like JOIN stage with OUTER JOIN,Lookup stage and CDC stage.
In this solution, I will use Change Data Capture (CDC) stage.
Final job design would be like this:
Final-job-design-with-CDC-stage

My first input set records that has the records from 1 to 6.

first-input-data-cdc-test

My second input set records that has the records from 4 to 9.

second-input-data-cdc-test

Edit the CDC stage properties exactly like below.
Key = Key Column Name ( I have given column name as Key)

Edit-the-CDC-stage-properties

As we aware CDC stage expects before and after datasets, select the before and after datasets appropriately.

select-the-before-and-after-datasets

Just map the change_code and Key column to the output.

map-the-change-code-and-Key-column
Change code =0 means Copy records
Change code =1 means Insert records
Change code =2 means Delete records
Put a constraint according to the change code values in transformer stage.

constraint-according-to-the-change-code-values

Compile and run the job.

final-design-compile-and-run-the-job

Here are the three outputs:

output-data-file-1output-data-file-2output-data-file-3

Comments

comments

4 Comments

  1. kumar July 21, 2020
    • Admin July 21, 2020
  2. kumar July 21, 2020
    • Admin July 21, 2020

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: