Hi Friends,
I have a input data like,
class_id Marks
101 50
101 60
101 40
102 90
102 35
And i want my output data like
class_id Marks Rank
101 50 2
101 60 1
101 40 3
102 90 1
102 35 2
how to do this in datastage?
Answer Posted / indu
Input->Sort1->Sort2->Trnsformer->Output
Sort1-->Declare class_id and Marks as key column and sort
in descding order.
Sort2-->Declare class_id and Marks as key column(Sort Mode
to Dont sort previously sorted for both) and set clustered
key change column to true.
Otuput for Sort 2 will be
class_id Marks Rank
102 90 1
102 35 0
101 60 1
101 50 0
101 40 0
In the Transformer declare stage variable temp and
initialize to o
Derive temp--> If Rnak=1 then Rank else temp+1
Derive output columns as --->
class_id ---> class_id
Marks ----> Marks
Rank----> temp
Is This Answer Correct ? | 13 Yes | 10 No |
Post New Answer View All Answers
Is the value of staging variable stored temporarily or permanently?
if i have two tables table1 table2 1a 1a,b,c,d 1b 2a,b,c,d,e 1c 1d 2a 2b 2c 2d 2e how can i get data as same as in tables? how can i implement scd typ1 and type2 in both server and in parallel? field1 field2 field3 suresh , 10,324 , 355 , 1234 ram , 23,456 , 450 , 456 balu ,40,346,23 , 275, 5678 how to remove the duplicate rows,inthe fields?
Define Merge?
How can we improve the performance in datastage?
What is a quality stage in datastage tool?
whom do you report?
How do you import and export the datastage jobs?
Is it possible to query a hash file?
how to write server Routine coding?
If you want to use the same piece of code in different jobs, how will you achieve it?
Name the command line functions to import and export the DS jobs?
How to reverse the string using unix?
What is the difference between in process and inter process?
Nls stands for what in datastage?
How do you run datastage job from the command line?