View previous topic :: View next topic
|
Author |
Message |
jobin thomas
New User
Joined: 19 Aug 2008 Posts: 15 Location: Bangalore
|
|
|
|
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 |
|
|
jobin thomas
New User
Joined: 19 Aug 2008 Posts: 15 Location: Bangalore
|
|
|
|
Reposting the output order again
Code: |
AAAA 3333333333333333
AAAA 1111111111111111
AAAA 2222222222222222
BBBB 2222222222222222
BBBB 1111111111111111
CCCC 1111111111111111 |
|
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
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 |
|
|
Ketan Varhade
Active User
Joined: 29 Jun 2009 Posts: 197 Location: Mumbai
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
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 |
|
|
jobin thomas
New User
Joined: 19 Aug 2008 Posts: 15 Location: Bangalore
|
|
|
|
Thanks very much for the reply.
I'll use paramter OPTION EQUALS. |
|
Back to top |
|
|
|