Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Sort Numeric field with spaces

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
ismail.hasan

New User


Joined: 28 Mar 2007
Posts: 20
Location: India

PostPosted: Mon Dec 22, 2008 6:50 pm    Post subject: Sort Numeric field with spaces
Reply with quote

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
View user's profile Send private message

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Mon Dec 22, 2008 7:27 pm    Post subject:
Reply with quote

Numeric fields need to be justified to get the correct results from a sort process.

Where are these numbers supplied from ?
Back to top
View user's profile Send private message
ismail.hasan

New User


Joined: 28 Mar 2007
Posts: 20
Location: India

PostPosted: Mon Dec 22, 2008 7:31 pm    Post subject:
Reply with quote

From a Input file which is fetched from the database.
using cast functionality.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2238
Location: @my desk

PostPosted: Mon Dec 22, 2008 7:42 pm    Post subject:
Reply with quote

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
View user's profile Send private message
ismail.hasan

New User


Joined: 28 Mar 2007
Posts: 20
Location: India

PostPosted: Mon Dec 22, 2008 7:47 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2238
Location: @my desk

PostPosted: Mon Dec 22, 2008 8:26 pm    Post subject:
Reply with quote

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
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Tue Dec 23, 2008 6:42 am    Post subject:
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2238
Location: @my desk

PostPosted: Tue Dec 23, 2008 9:05 am    Post subject:
Reply with quote

Gerry,

But if the same could be achieved in SQL itself, should n't he be going for that?
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Tue Dec 23, 2008 9:29 am    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Innovations in Your Mainframe Sort Arun Raj PC Guides & IT News 4 Wed Mar 15, 2017 10:38 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts SORT requirement sjiraga COBOL Programming 6 Thu Mar 09, 2017 9:11 pm
No new posts IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm
No new posts SORT to append Month and YEAR in MMYY... tisamf DFSORT/ICETOOL 1 Wed Mar 08, 2017 4:46 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us