View previous topic :: View next topic
|
Author |
Message |
ismail.hasan
New User
Joined: 28 Mar 2007 Posts: 21 Location: India
|
|
|
|
Hi
My Input values are like this
1
5
3
203
100
20
1002
2
200
10
After sort using syncsort data type CH length (1,4)
What i am getting is
1
10
100
1002
2
20
200
203
3
5
But I need output file in the below format:
1
2
3
5
10
20
100
200
203
1002
Seeking your guidance.
Thanks is Advance.
Ismail |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Numeric fields need to be justified to get the correct results from a sort process.
Where are these numbers supplied from ? |
|
Back to top |
|
|
ismail.hasan
New User
Joined: 28 Mar 2007 Posts: 21 Location: India
|
|
|
|
From a Input file which is fetched from the database.
using cast functionality. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
ismail.hasan,
You CAN do this in sort. BTW, what is your source table column definition for this? Isn't it possible to do an ORDER by while fetching these values. |
|
Back to top |
|
|
ismail.hasan
New User
Joined: 28 Mar 2007 Posts: 21 Location: India
|
|
|
|
No I am using union. So group by or order by are not possible for the all the fetch in a single strecth |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Quote: |
So group by or order by are not possible for the all the fetch in a single strecth |
Did you try giving ORDER BY and UNION together? Can you please post here the SQL using 'Code' tags? |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
you can try this
Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
1
5
3
203
100
20
1002
2
200
10
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(1,04,UFF,A)
/*
|
Gerry |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Gerry,
But if the same could be achieved in SQL itself, should n't he be going for that? |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi Arun,
my answer was based on the the subject line
Quote: |
Sort Numeric field with spaces |
I don't disagree with you, doing it at the source level is always the better option.
Gerry |
|
Back to top |
|
|
|