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
Name the different types of Lookups in Datastage?
How to convert RGB Value to Hexadecimal values in datastage?
Hi All , in PX Job I have passed 4 Parameters and when i run the same job in sequence i dont want to use those parameters , is this possible if yes then how
how to implement scd2 in datastage 7.5 with lookup stage
Differentiate between operational datastage (ods) and data warehouse?
Explain connectivity between datastage with datasources?
What are the main differences you have observed between 7.x and 8.x version of datastage?
A signal has a wavelength of 1 micro min in air.how far can the front of the wave travel during 1000periods?
How do you import and export data into datastage?
Define Data Stage?
What is meta stage?
What is use Array size in datastage
What is oci?
how do u catch bad rows from OCI stage? And what CLI stands for?
Hi , Can anyone give few examples of scenarios and there corresponding design in datastage..i am new to this tool...confused in design while my manager asking to design the job.. Please post the URL if there..so i can go through it.. Thanks in advance...