Datastage Job Design

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
adityavarma
Premium Member
Premium Member
Posts: 104
Joined: Thu Jul 12, 2007 11:32 pm
Location: Canada

Datastage Job Design

Post by adityavarma »

Hi,
I need to design a datastage job for the below mentioned SQL.

Select col1, col2
From dm_LIM
Where (code, REF_DT) in (Select code, max(REF_DT)
From dm_LIM LIM, dm_syu
Where LIM.code= SYU.code And LIM.REF_DT <= SYU.REF_DT)

I am not sure which Stage I should use to implement the logic for (Where LIM.code= SYU.code And LIM.REF_DT <= SYU.REF_DT)

Can you please help me with this?
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

why not join/Lookup with filter?

edit :join/Lookup instead of join filter
Last edited by priyadarshikunal on Tue Aug 10, 2010 5:15 am, edited 1 time in total.
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
venkatdev
Participant
Posts: 4
Joined: Wed Jul 14, 2010 11:45 pm

Post by venkatdev »

Select col1, col2
From dm_LIM
Where (code, REF_DT) in (Select code, max(REF_DT)
From dm_LIM LIM, dm_syu
Where LIM.code= SYU.code And LIM.REF_DT <= SYU.REF_DT)

I am not sure which Stage I should use to implement the logic for (Where LIM.code= SYU.code And LIM.REF_DT <= SYU.REF_DT)

Here dm_LIM is ur driving table and dm_syu is ur reference table ..Join both these tables based on the LIM.code= SYU.code and extract the required columns , then in transformer stage u file with LIM.REF_DT <= SYU.REF_DT.

Note: U can find the max(REF_DT) befor joing based on the key column ..
Venkat
adityavarma
Premium Member
Premium Member
Posts: 104
Joined: Thu Jul 12, 2007 11:32 pm
Location: Canada

Post by adityavarma »

priyadarshikunal wrote:why not join/filter with filter?
Thanks for your quick reply Kunal. It worked for me.
adityavarma
Premium Member
Premium Member
Posts: 104
Joined: Thu Jul 12, 2007 11:32 pm
Location: Canada

Post by adityavarma »

Thanks for your reply Venkat. How can find the MAX(REF_DT) before join?
nitkuar
Participant
Posts: 46
Joined: Mon Jun 23, 2008 3:09 am

Post by nitkuar »

Hi Aditya,

I guess, you are trying to find the max value of date column after the join operation. This is what, being depicted by SQL query as well.
Use Rdup stage after filter stage with data sorted on Date column key as secondory key(business key being primary, previous join key in your case).

Regards
Nitin
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

venkatdev wrote:U can find the max(REF_DT) befor joing based on the key column ..
U may not wish to do so.

The second person personal pronoun in English is spelled "you". U is one of our posters (it's a fairly common Burmese name).
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