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 for multiple records having same sort key

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
jobin thomas

New User


Joined: 19 Aug 2008
Posts: 15
Location: Bangalore

PostPosted: Mon Aug 31, 2009 11:59 am    Post subject: Sorting Order for multiple records having same sort key
Reply with quote

Hi


SYNCSORT sort mulitple records having the same sort key as below:
INPUT:
Code:

AAAA 3333333333333333
BBBB 2222222222222222
CCCC 1111111111111111
AAAA 1111111111111111
BBBB 1111111111111111
AAAA 2222222222222222

SORT CARD:
Code:
SORT FIELDS=(1,4,CH,A)

OUTPUT:
Code:
AAAA 3333333333333333
AAAA 1111111111111111
AAAA 2222222222222222
BBBB 1111111111111111
BBBB 2222222222222222
CCCC 1111111111111111

i.e., for the records having same SORT KEY, the order in which they appear in output is same as that which was in input file.

I wanted to refer to some online manual to confirm the same, but couldn't find. Will there be any exceptions to it. I mean does sort always work this way. Please confirm.

If yes, this would relieve me from adding sequence numbers to the records and then sorting so that the order in which mulitple records having same sort key is found in input file won't jumple up in output file.

Regards
Back to top
View user's profile Send private message

jobin thomas

New User


Joined: 19 Aug 2008
Posts: 15
Location: Bangalore

PostPosted: Mon Aug 31, 2009 12:02 pm    Post subject:
Reply with quote

Reposting the output order again

Code:
AAAA 3333333333333333
AAAA 1111111111111111
AAAA 2222222222222222
BBBB 2222222222222222
BBBB 1111111111111111
CCCC 1111111111111111
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Mon Aug 31, 2009 12:04 pm    Post subject:
Reply with quote

Quote:
I mean does sort always work this way. Please confirm.

Yes it does.. if you dont add any more sort keys to it
Back to top
View user's profile Send private message
Ketan Varhade

Active User


Joined: 29 Jun 2009
Posts: 197
Location: Mumbai

PostPosted: Mon Aug 31, 2009 12:05 pm    Post subject:
Reply with quote

Hi,
You can use OPTION EQUAL to not the disturb the order of the input data for the same key value, You can refer to the manual for more info on OPTIONS EQUAL
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10210
Location: italy

PostPosted: Mon Aug 31, 2009 12:12 pm    Post subject: Reply to: Sorting Order for multiple records having same sor
Reply with quote

the question is not very clear, anyhow

the sort order for duplicate records ( records with the same sort key ) is unpredictable (*)

as a general point, sort environment changes will affect the sequence of duplicate records
- storage available
- number of workfiles

the OPTION EQUALS sort directive will keep the duplicate records in the same sequence they were in the input file
Back to top
View user's profile Send private message
jobin thomas

New User


Joined: 19 Aug 2008
Posts: 15
Location: Bangalore

PostPosted: Mon Aug 31, 2009 12:25 pm    Post subject:
Reply with quote

Thanks very much for the reply.
I'll use paramter OPTION EQUALS.
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Order BY AND Index Nileshkul DB2 2 Sat Dec 31, 2016 6:33 pm
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm


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