How to achieve rank functionality in Datastage

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
prasad v
Participant
Posts: 174
Joined: Mon Mar 30, 2009 2:18 am

How to achieve rank functionality in Datastage

Post by prasad v »

Hi

I need to implement a job to get the Top 2 nd salary in Datastage.
Datasource is MS Sql Server.
Datastage Version is 7.5 Parallel.

I know we can write a query and keep it in the jobs can achieve.
but i need to build this in Job as we need to improve the performance of the Jobs.

You can take an example data of emp table in oracle database.

Can any one advise how to do this?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

This is a query, or report. It is not the type of task an ETL should be asked to perform.

There IS a solution, using stage variables. Even without sorting, remember the highest and second highest value thus far processed and, downstream of the Transformer stage, limit output to the last row containing the value(s) of the stage variable(s) as link column(s).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
keshav0307
Premium Member
Premium Member
Posts: 783
Joined: Mon Jan 16, 2006 10:17 pm
Location: Sydney, Australia

Post by keshav0307 »

i need to build this in Job as we need to improve the performance of the Jobs
Not Sure if you get it.


do you want top 2 salaried employee of all department, or top 2 salaried employee in each department??
prasad v
Participant
Posts: 174
Joined: Mon Mar 30, 2009 2:18 am

Post by prasad v »

I need top 2 salaries in the entire EMP table irrespective of Dept.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Select sorted in descending order. Constrain on input row number = 2. Read what I said about this not being an ETL task.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply