MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Different Sort order(Numbers before alphabets) !

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
lacoe1
Beginner


Joined: 24 Feb 2005
Posts: 33
Topics: 17

PostPosted: Thu Feb 24, 2005 3:02 pm    Post subject: Different Sort order(Numbers before alphabets) ! Reply with quote

I have an input file with the following
BA
00
TX
C3
C1
C2
C3
This needs to be sorted as
00
BA
C1
C2
C3
TX
Any suggestions? We are using SORT, but the results are not what we would like to see.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Thu Feb 24, 2005 3:23 pm    Post subject: Reply with quote

lacoe1,

So you want numerics to be first followed by alphabetic values? If so then the following JCL will give you the desired results. The format AC will sort according to the ASCII sequence which has the numbers before the letters.

Code:

//STEP0100 EXEC  PGM=SORT             
//SYSOUT   DD SYSOUT=*               
//SORTIN   DD *                       
BA                                   
00                                   
TX                                   
C3                                   
C1                                   
C2                                   
C3                                   
//SORTOUT DD SYSOUT=*                 
//SYSIN   DD *                       
   SORT FIELDS=(1,2,AC,A)             
/*     


Hope this helps...

Cheers

kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
lacoe1
Beginner


Joined: 24 Feb 2005
Posts: 33
Topics: 17

PostPosted: Thu Feb 24, 2005 3:36 pm    Post subject: Reply with quote

Kolusu, thanks for the response. Just 1 problem, the results gave
00
BA
C3
C1
C2
C3
TX
The C3 did not move after C2, rather it stayed right after BA.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Thu Feb 24, 2005 3:45 pm    Post subject: Reply with quote

lacoe1,

The Job Posted by me gives the correct results.
Code:

//STEP0100 EXEC  PGM=SORT   
//SYSOUT   DD SYSOUT=*     
//SORTIN   DD *             
BA                         
00                         
TX                         
C3                         
C1                         
C2                         
C3                         
//SORTOUT DD SYSOUT=*       
//SYSIN   DD *             
   SORT FIELDS=(1,2,AC,A)   
/*                         


The output is
Code:

00
BA
C1
C2
C3
C3
TX


If you are not getting the same results, then can you post your entire sysout messages?

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
lacoe1
Beginner


Joined: 24 Feb 2005
Posts: 33
Topics: 17

PostPosted: Thu Feb 24, 2005 3:53 pm    Post subject: Reply with quote

You are right. It works. My starting position in the file was incorrect.

Thank you.
Back to top
View user's profile Send private message
dtf
Beginner


Joined: 10 Dec 2004
Posts: 110
Topics: 8
Location: Colorado USA

PostPosted: Thu Feb 24, 2005 4:01 pm    Post subject: Reply with quote

I think there is also a sort control parameter ALTSEQ which can be used to assign any collating sequence that you want.

DTF
________
Yamaha YZ125 history


Last edited by dtf on Tue Feb 01, 2011 1:47 pm; edited 1 time in total
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu Feb 24, 2005 4:37 pm    Post subject: Reply with quote

DTF,

You could collate '0'-'9' before 'A' like this:

Code:

//STEP0100 EXEC  PGM=SORT   
//SYSOUT   DD SYSOUT=*     
//SORTIN   DD *             
BA                         
00                         
TX                         
C3                         
C1                         
C2                         
C3                         
//SORTOUT DD SYSOUT=*       
//SYSIN   DD *           
   SORT FIELDS=(1,2,AQ,A)
   ALTSEQ CODE=(F0B0,F1B1,F2B2,F3B3,F4B4,   
                F5B5,F6B6,F7B7,F8B8,F9B9) 
/*


but AC is really the better way to collate numbers before uppercase letters.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
dtf
Beginner


Joined: 10 Dec 2004
Posts: 110
Topics: 8
Location: Colorado USA

PostPosted: Thu Feb 24, 2005 10:47 pm    Post subject: Reply with quote

I was only pointing out that ALTSEQ gives one the flexability to change the collating sequence in any way you want........
________
Motorcycle tires


Last edited by dtf on Tue Mar 15, 2011 5:00 am; edited 1 time in total
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Fri Feb 25, 2005 11:09 am    Post subject: Reply with quote

"to change the any collating sequence that you want" is a little overstated, but yes, ALTSEQ does give you some flexibility to change the collating positions of characters in the 256-byte EBCDIC table.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group