Input Data is:
Emp_Id, EmpInd
100, 0
100, 0
100, 0
101, 1
101, 1
102, 0
102, 0
102, 1
103, 1
103, 1
I want Output
100, 0
100, 0
100, 0
101, 1
101, 1
Means Indicator should either all ZEROs or all ONEs per
EmpId.
Impliment this using SQL and DataStage both.

Answer Posted / akila ramu

DB--->Transformer--->Output File

Sample data propagation through these stages:
In table->DB stage--->Tfm----->outputfile
101 0---->100 0 2 2-->100 0
100 0---->101 0 2 1-->100 0
101 1---->101 1 2 1
100 0

DB: Use the bvelow query in this stage
select emp_id, ind, count(emp_id) c1, count(emp_id ind) c2
from table_name
group by emp_id, ind
order by emp_id, ind
So similar empid-ind are grouped and the count of each
empid-ind pair is also sent in a seperate column c2. The
count of each emp_id is sent in c1.

Tfm: Output link Contraint:c1=c2
Looping contraint: @ITERATION<=c2
Looping variables: l_empid=emp_id
l_ind=ind

Pass these two looping variables as the emp_id and the ind
to the output file.

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what are the errors,warnings in datastage

2154


What is the purpose of pivot stage?

607


What is the difference between operational data stage (ods) and data warehouse?

675


how to delete one row in target dataset

2588


How many types of hash files are there?

611






Define data aggregation?

669


Describe the architecture of datastage?

570


How do you import and export the datastage jobs?

735


how to read 100 records at a time in source a) hw is it fr metadata Same and b) if metadata is nt same?

1718


What is use Array size in datastage

1308


What is a ds designer?

642


What is size of a transaction and an array means in a datastage?

739


How do you start developing a datastage project?

660


How to perform incremental load in datastage?

668


What is the difference between server job and parallel jobs?

672