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
Describe routines in datastage? Enlist various types of routines.
What are orabulk and bcp stages?
Define Merge?
What are sequencers?
How a routine is called in datastage job?
what is the use of skid in reporting?
What is merge stage?
What is the use of datastage designer?
What are routines in datastage? Enlist various types of routines.
8000 jobs r there i given commit, suddenly job will abort? what happens? 2)diff b/t transformer stage & filter stage? 3)how to load the data in the source?
what is stage is used for below Input columns: dept|mgr|employee|salary Output columns: mgr|count of employee per mgr|avg salary per dept note: each dept has one mgr and each mgr has many employees
explain about citrix scheduling tool in datastage
What is a datastage job?
root tree will find which is server job and which is parallel job?
What is the purpose of interprocessor stage in server jobs?