Page 1 of 1

Sort utility in sort stage

Posted: Fri Apr 19, 2013 3:16 am
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?

Posted: Fri Apr 19, 2013 5:04 am
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.

Re: Sort utility in sort stage

Posted: Fri Apr 19, 2013 6:46 am
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:

Re: Sort utility in sort stage

Posted: Fri Apr 19, 2013 12:38 pm
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.