Taking the sorted data

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
fmou
Participant
Posts: 124
Joined: Sat May 28, 2011 9:48 pm

Taking the sorted data

Post by fmou »

Hi,

It is recommended to use the "same" method when the data is sorted in previous stages, however, I'm wondering what if the previous stage is a database stage, that sorts data using the "order by" sql clause.

Can I still use the "same"sorting method?

thanks
asorrell
Posts: 1707
Joined: Fri Apr 04, 2003 2:00 pm
Location: Colleyville, Texas

Post by asorrell »

That's a great question...

If the sort is done by the database (ie: an ORDER BY clause) then DataStage doesn't have visibility to the keys, so "SAME" doesn't quite cover it.

What you should do is insert a SORT stage after the database stage and mark all the keys (and sorting orders) on the stage. Then change all the Sort Key Modes to "Don't Sort - Previously Sorted". This makes sure that DataStage has the required information but won't attempt to resort the data. Any stages after that can use the "Same" option safely.
Andy Sorrell
Certified DataStage Consultant
IBM Analytics Champion 2009 - 2020
fmou
Participant
Posts: 124
Joined: Sat May 28, 2011 9:48 pm

Post by fmou »

Again, exactly the answers that I was looking for! Thanks a lot.

One more question to make it complete, if I use " Don't Sort - Previously Sorted ", will the "key field changed", "group changed" DS fields get popIulated correctly? If no, I do have to "re-sort" it in DS, right?

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

Post by ray.wurlod »

The generated fields will be populated correctly provided you have not lied about the "already sorted/grouped" assertion.
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