Sort

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
cosec
Premium Member
Premium Member
Posts: 230
Joined: Tue May 08, 2007 8:10 pm

Sort

Post by cosec »

Hello,

I am loading data in to DB2 Tables. The Source is a sorted sequential file and all my target tables are sorted except for one. Is there a way to correct this without using a sort stage ?

Thanks

Hazmar
rafik2k
Participant
Posts: 182
Joined: Wed Nov 23, 2005 1:36 am
Location: Sydney

Post by rafik2k »

If you don't want use sort stage, then treat the unsorted table as dummy table. Create another new table with the same structure.

Select all columns from dummy table as order by clause in asc or desc and pass as it is into target new table.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Yea, do an "order by clause" on this unsorted table and load it to a flat file. Pass a truncate on the table and reload the sorted data.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Re: Sort

Post by chulett »

cosec wrote:and all my target tables are sorted except for one.
What is that supposed to mean? Is it a 'DB2 thing' where tables can be... 'sorted'? :?

Or are we just talking about doing an initial load sorted in a fashion that matches the PK of the target table?
-craig

"You can never have too many knives" -- Logan Nine Fingers
Minhajuddin
Participant
Posts: 467
Joined: Tue Mar 20, 2007 6:36 am
Location: Chennai
Contact:

Re: Sort

Post by Minhajuddin »

cosec wrote:Hello,

I am loading data in to DB2 Tables. The Source is a sorted sequential file and all my target tables are sorted except for one. Is there a way to correct this without using a sort stage ?

Thanks

Hazmar
What do you mean by "Is there a way to correct this without using a sort stage ?". Can you shed some light on it.
Minhajuddin

<a href="http://feeds.feedburner.com/~r/MyExperi ... ~6/2"><img src="http://feeds.feedburner.com/MyExperienc ... lrow.3.gif" alt="My experiences with this DLROW" border="0"></a>
michaeld
Premium Member
Premium Member
Posts: 88
Joined: Tue Apr 04, 2006 8:42 am
Location: Toronto, Canada

Post by michaeld »

You can set the APT_NO_SORT_INSERTION parameter and in the sort stage set the "don't sort previousley sorted" option. You also need to make sure that the job runs in sequential mode. Otherwise partitioning may mess up the order.

If you need to run it in parallel mode then you will need to pick the sorted collection method in your DB stage. This will do some sorting, but it's not as bad as a total resort because it will only do a single pass on the data.
Mike
Post Reply