View previous topic :: View next topic |
Author |
Message |
lacoe1 Beginner
Joined: 24 Feb 2005 Posts: 33 Topics: 17
|
Posted: Thu Feb 24, 2005 3:02 pm Post subject: Different Sort order(Numbers before alphabets) ! |
|
|
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 |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Thu Feb 24, 2005 3:23 pm Post subject: |
|
|
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 |
|
 |
lacoe1 Beginner
Joined: 24 Feb 2005 Posts: 33 Topics: 17
|
Posted: Thu Feb 24, 2005 3:36 pm Post subject: |
|
|
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 |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Thu Feb 24, 2005 3:45 pm Post subject: |
|
|
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 |
|
 |
lacoe1 Beginner
Joined: 24 Feb 2005 Posts: 33 Topics: 17
|
Posted: Thu Feb 24, 2005 3:53 pm Post subject: |
|
|
You are right. It works. My starting position in the file was incorrect.
Thank you. |
|
Back to top |
|
 |
dtf Beginner
Joined: 10 Dec 2004 Posts: 110 Topics: 8 Location: Colorado USA
|
Posted: Thu Feb 24, 2005 4:01 pm Post subject: |
|
|
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 |
|
 |
Frank Yaeger Sort Forum Moderator

Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
|
Posted: Thu Feb 24, 2005 4:37 pm Post subject: |
|
|
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 |
|
 |
dtf Beginner
Joined: 10 Dec 2004 Posts: 110 Topics: 8 Location: Colorado USA
|
Posted: Thu Feb 24, 2005 10:47 pm Post subject: |
|
|
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 |
|
 |
Frank Yaeger Sort Forum Moderator

Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
|
Posted: Fri Feb 25, 2005 11:09 am Post subject: |
|
|
"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 |
|
 |
|
|