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 / shar
Ok
1) sql:
select empno, rank() over(order by empno) Ind from e2;
then we get:
100 1
100 1
100 1
101 2
101 2
103 3
2) Datastage:
sequl file-->sort-->tx--> Target.
@sort:
create keychange column then we get
100 0
100 1
100 1
101 0
101 1
101 1
102 0
102 1
103 0
@ Tx use two stage variables:
sv1 integer = 0 value
sv2 integer = 0 value
and at derivations :
assign
1) keychange ---> sv1
2) if sv1=0 then sv2+1 else sv2 ----> sv2
map the columns empno and sv2
and we get the results.
Thats it.
shar
Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
Where do the datastage jobs get stored?
How do you import and export the datastage jobs?
How the ipc stage work?
What are the functionalities of link collector?
What is the difference between validated and compiled in the datastage?
What is the difference between passive stage and active stage?
What steps should be taken to improve Datastage jobs?
whom do you report?
What is the method of removing duplicates, without the remove duplicate stage?
Explain the datastage parallel extender (px) or enterprise edition (ee)?
What is the difference between the local container and shared container?
What are sequencers?
Difference between data warehousing and olap?
What are the partitioning techniques available in link partitioner?
If we take 2 tables(like emp and dept),we use join stage and how to improve the performance?