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

Sorting Order for multiple records having same sort key


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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
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
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Aug 31, 2009 12:12 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top