IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Sorting order using DFSORT in one JCL step


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
satish.ms10

Active User


Joined: 10 Aug 2009
Posts: 184
Location: India

PostPosted: Wed May 19, 2010 5:32 pm
Reply with quote

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

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed May 19, 2010 6:04 pm
Reply with quote

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

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed May 19, 2010 8:32 pm
Reply with quote

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

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed May 19, 2010 9:10 pm
Reply with quote

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

Active User


Joined: 10 Aug 2009
Posts: 184
Location: India

PostPosted: Thu May 20, 2010 3:26 pm
Reply with quote

Thank you very much for your suggestions and solution.

It worked.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Return codes-Normal & Abnormal te... JCL & VSAM 7
No new posts DFsort help with SUM() DFSORT/ICETOOL 12
Search our Forums:

Back to Top