Sort utility in sort stage

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
soumya5891
Participant
Posts: 152
Joined: Mon Mar 07, 2011 6:16 am

Sort utility in sort stage

Post by soumya5891 »

I have created a simple datastage job which performs the following.

1. Prepare data using row generator stage(10 integer records starting from 1 to 10) with only one column COL1
2. Perform a sequential sort using a sort stage(descending sort)
3. Write the records into a text file.


I have used sort utility as both datastage and UNIX and observed the following.

Output(Datastage sort):

10
9
8
7
6
5
4
3
2
1

Which is working perfectly.

Output(UNIX sort):

9
8
7
6
5
4
3
2
10
1


Is not giving the proper output.

In UNIX it always sort the records as String by default.The command for numeric sort is

sort -n <filename>

How can we achive this in datastage if we choose sort utility as UNIX in sort stage?

Also is there any such guidline to use datastage sort and UNIX sort?
Soumya
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

What is the data type of the column you're sorting?

Incidentally, DataStage sort in 8.1.1 and later will always out-perform Unix sort. The option has really only been left in the stage for backwards compatibility.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Re: Sort utility in sort stage

Post by chulett »

soumya5891 wrote:Also is there any such guidline to use datastage sort and UNIX sort?
That's simple - don't use the UNIX sort. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
soumya5891
Participant
Posts: 152
Joined: Mon Mar 07, 2011 6:16 am

Re: Sort utility in sort stage

Post by soumya5891 »

Thanks all for your reply.

@Ray : Datatype I have used as Integer

@Chulett : Everywhere I have used Datastage sort . I was reading about psort and tsort, then I have tried this by developing sample job and saw the difference.
Soumya
Post Reply