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


Please Help Members By Posting Answers For Below Questions

Where do the datastage jobs get stored?

737


How do you import and export the datastage jobs?

741


How the ipc stage work?

680


What are the functionalities of link collector?

633


What is the difference between validated and compiled in the datastage?

707






What is the difference between passive stage and active stage?

832


What steps should be taken to improve Datastage jobs?

646


whom do you report?

1509


What is the method of removing duplicates, without the remove duplicate stage?

592


Explain the datastage parallel extender (px) or enterprise edition (ee)?

747


What is the difference between the local container and shared container?

656


What are sequencers?

619


Difference between data warehousing and olap?

657


What are the partitioning techniques available in link partitioner?

1761


If we take 2 tables(like emp and dept),we use join stage and how to improve the performance?

1642