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


Please Help Members By Posting Answers For Below Questions

Is the value of staging variable stored temporarily or permanently?

577


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?

1747


Define Merge?

879


How can we improve the performance in datastage?

654


What is a quality stage in datastage tool?

632






whom do you report?

1504


How do you import and export the datastage jobs?

735


Is it possible to query a hash file?

1565


how to write server Routine coding?

1667


If you want to use the same piece of code in different jobs, how will you achieve it?

636


Name the command line functions to import and export the DS jobs?

709


How to reverse the string using unix?

2812


What is the difference between in process and inter process?

672


Nls stands for what in datastage?

728


How do you run datastage job from the command line?

604