View previous topic :: View next topic
|
Author |
Message |
satish.ms10
Active User
Joined: 10 Aug 2009 Posts: 184 Location: India
|
|
|
|
Hi
I have the following data in key field of a PS file.
Code: |
F9456
00000
12345
C7890
23456
32253
E1234
99999
A1234
B2345
D2345
F1234
00001
|
If I sort this data using
Code: |
SORT FIELDS=(1,5,A),FORMAT=CH |
I am getting data in the following order.
Code: |
A1234
B2345
C7890
D2345
E1234
F1234
F9456
00000
00001
12345
23456
32253
99999 |
But I want the output data in the following order
Code: |
00000
00001
12345
23456
32253
99999
A1234
B2345
C7890
D2345
E1234
F1234
F9456 |
Is there any way to get the results in the above order using DFSORT in one JCL step?
Please help me.
Thanks in advance. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
You need to research EBCDIC and ASCII collating sequence. The sorted order you show is what is expected on an EBCDIC machine -- in EBCDIC, the numbers come AFTER the letters whereas ASCII places the numbers BEFORE the letters. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Suggest you re-consider. . .
Even if/when you get the data in the order you believe you want, it will cause problems later when used in various processes.
While you can force this "sequence" (it is actually an out-of-sequence), you cannot force the computer to compare these the way you want. In a comparison A (x'C1') is less than 0 (x'F0'). Code that depends on comparing one value to another will at best abend. If it merely runs wrong, this can introduce all kinds of data / report corruption. . . |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
satish.ms10,
you need to use AC format which sorts EBCDIC data using the ISCII/ASCII collating sequence.
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
F9456
00000
12345
C7890
23456
32253
E1234
99999
A1234
B2345
D2345
F1234
00001
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(1,5,AC,A),EQUALS
//* |
|
|
Back to top |
|
|
satish.ms10
Active User
Joined: 10 Aug 2009 Posts: 184 Location: India
|
|
|
|
Thank you very much for your suggestions and solution.
It worked. |
|
Back to top |
|
|
|