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
What are the enhancements made in datastage 7.5 compare with 7.0?
how to achieve this output ? Two Input columns(ID & Name) - ID | Name 1 | Jack 1 | Kara In output there should be only 1 column which will be populated as - 1,Jack 1,Kara
1)s.key generate 1 to 700 records today. tomorrow another 400 will updated how to update the records using s.key generator? 2)source is like :-- DB --> T/F stage1 --> seq1file T/f 1 is linking with T/F2 ---> seq 2 how to load the data? in source i given some conditions those r going in seq1. The another data will going to seq2 how to do this ?
how to sort two columns in single job in datastage.
How can we perform the 2nd time extraction of client database without accepting the data which is already loaded in first time extraction?
Which warehouse using in your datawarehouse
What are the steps needed to create a simple basic datastage job?
What is staging variable?
What are the various kinds of the hash file?
project Steps,hits, Project level HArd things,Solved methods?
What are the job parameters?
im new to this tool im now at project plz tell me step by step process how to design plz help me i wnt to go with exp for job plz give me d proper design and explination
client know skid info?
What is datastage?
What are the functionalities of link partitioner and link collector?