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
 

 

Sorting order using DFSORT in one JCL step

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

Active User


Joined: 10 Aug 2009
Posts: 158
Location: India

PostPosted: Wed May 19, 2010 5:32 pm    Post subject: Sorting order using DFSORT in one JCL step
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: 7935
Location: Bellevue, IA

PostPosted: Wed May 19, 2010 6:04 pm    Post subject:
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

Site Director


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

PostPosted: Wed May 19, 2010 8:32 pm    Post subject:
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    Post subject:
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: 158
Location: India

PostPosted: Thu May 20, 2010 3:26 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Sorting group data rajella DFSORT/ICETOOL 3 Sun Jan 22, 2017 11:32 pm
No new posts Order BY AND Index Nileshkul DB2 2 Sat Dec 31, 2016 6:33 pm
No new posts How to get the remainder and quotient... vnktrrd DFSORT/ICETOOL 2 Mon Oct 31, 2016 10:59 am
No new posts Efficient sorting chandracdac DFSORT/ICETOOL 5 Sat Oct 22, 2016 3:23 am
No new posts Stripping and Sorting of VB file G SRINIVASA RAO SYNCSORT 5 Wed Sep 14, 2016 1:34 pm


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