Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
satish.ms10

Active User

Joined: 10 Aug 2009
Posts: 161
Location: India

Posted: Wed May 19, 2010 5:32 pm    Post subject: Sorting order using DFSORT in one JCL step

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?

Robert Sample

Global Moderator

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

 Posted: Wed May 19, 2010 6:04 pm    Post subject: 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.
dick scherrer

Site Director

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

 Posted: Wed May 19, 2010 8:32 pm    Post subject: 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. . .
Skolusu

Senior Member

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

Posted: Wed May 19, 2010 9:10 pm    Post subject:

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      //*
satish.ms10

Active User

Joined: 10 Aug 2009
Posts: 161
Location: India

 Posted: Thu May 20, 2010 3:26 pm    Post subject: Thank you very much for your suggestions and solution. It worked.
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Need urgent suggestion on DFSORT subratarec DFSORT/ICETOOL 6 Wed Mar 21, 2018 8:46 pm Xpediter: STEP OVER cobol section Auryn Compuware & Other Tools 0 Thu Feb 22, 2018 9:30 pm Preserve order in Input File pshongal DFSORT/ICETOOL 13 Thu Dec 21, 2017 4:20 pm Formatting using DFsort Guru Nandu DFSORT/ICETOOL 5 Thu Nov 30, 2017 7:33 am Compare VSAM files using DFSORT pshongal DFSORT/ICETOOL 5 Thu Nov 23, 2017 10:24 am

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us