Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Why is SORT rearranging records that are already sorted?

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

New User


Joined: 23 Jan 2018
Posts: 1
Location: USA

PostPosted: Wed Jan 24, 2018 10:14 pm    Post subject: Why is SORT rearranging records that are already sorted?
Reply with quote

I have several jobs that bring in multiple interface files, some of which have the same value in the sort columns (there's a potential to have additional values), so they are basically already sorted.

The jobs have been updated to always sort the input file, but the files that are already "sorted" are changed:

SORT card:
Code:
SORT  FIELDS=(1,3,CH,A)


Input file:
Code:
********************************* Top of Data *****************
001$CRESER122517 032000    AK80-04   D00000001928          AL09
001$CRESER122517 522090    AK80-04   C00000000964          AL09
001$CRESER122517 290061    AK80-04   C00000000964          AL09
001$CRESER122517 117001    AL09-01   D00000001928          AK80
001$CRESER122517 032000    AK82-04   D00000002122          AL09


Sorted file:
Code:
********************************* Top of Data *****************
001$CRESER122517 032000    AK80-04   D00000001928          AL09
001$CRESER122517 032000    OK06-06   D00000000000          TX46
001$CRESER122517 290061    UT04-04   C00000000000          WY05
001$CRESER122517 117001    WY05-01   D00000000000          UT04
001$CRESER122517 032000    WI02-02   D00000000000          WY05


Does anyone know how to avoid this?

Coded - do it yourself next time
You found the underline tags so using the code tags should be a doddle.
Back to top
View user's profile Send private message

prino

Senior Member


Joined: 07 Feb 2009
Posts: 1114
Location: Oostende, Belgium

PostPosted: Wed Jan 24, 2018 10:40 pm    Post subject:
Reply with quote

Read about stable and unstable sorts.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 714
Location: Pennsylvania

PostPosted: Wed Jan 24, 2018 10:50 pm    Post subject:
Reply with quote

SORT FIELDS=(1,3,CH,A) ,EQUALS

This will retain input order on equal keys.

Believe it or not, this is in the manual. icon_redface.gif
Back to top
View user's profile Send private message
enrico-sorichetti

Senior Member


Joined: 14 Mar 2007
Posts: 10492
Location: italy

PostPosted: Wed Jan 24, 2018 10:57 pm    Post subject: Reply to: Why is SORT rearranging records that are already sorted?
Reply with quote

Quote:
A COBOL Mainframe guru,

does not read no steenking manuals
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2059
Location: UK

PostPosted: Thu Jan 25, 2018 2:55 am    Post subject:
Reply with quote

Nothing to do with JCL. Moved to DFSort on the assumption that that is your sort product.
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 How to remove spaces between variable... Selvarajars DFSORT/ICETOOL 7 Fri Jul 27, 2018 3:58 pm
No new posts Copy records with unknown LRECL oerdgie DFSORT/ICETOOL 8 Tue Jul 24, 2018 7:50 pm
No new posts Need Help to Create 4 Output Records ... satish.ms10 DFSORT/ICETOOL 5 Thu Jul 19, 2018 1:55 am
No new posts finding anydata between positions of ... ram_vizag SYNCSORT 13 Tue Jul 17, 2018 9:14 pm
No new posts To remove spaces from a VB file using... Selvarajars DFSORT/ICETOOL 5 Thu Jun 21, 2018 6:57 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us