Posted: Wed Apr 29, 2009 2:45 am Post subject: ICETOOL - Sort results in different order of records. Why?
I wish to sort an input file of LRECL 357 on position 19, length 7 which is a packed decimal. Input file contains 300,000 records. Records having same value (as example) are located at 33777, 33835, 138230 and 252826 lines. When I execute the sort, the order became
252826, 33777, 33835, 138230
Now I copied only 400 records (including the 4 records as mentioned above). This time the the records are located in the input as 77, 135, 235, 326. When I executed the same sort as above, the order became
77, 326, 135, 235
Why the orders are different between both SORTs? And I want to retain the original order like
77, 135, 235 and 326 together/
33777, 33835, 138230 and 252826
If I just extract only those 4 records and sort it, I am getting the expected result. Can you help me?
use the EQUALS keyword, that maintains original order when sort keys are the same.
Frank/Kolusu can give a technical reason why,
but I imagine without EQUALS is UNPREDICTABLE sort order (within key). _________________ Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
Joined: 18 Feb 2006 Posts: 812 Location: San Jose, CA
Posted: Wed Apr 29, 2009 3:41 am Post subject:
Dick is correct. With EQUALS in effect, DFSORT keeps duplicate sorted or merged records in their original sequence. With NOEQUALS in effect, DFSORT may or may not keep duplicate records in their original sequence. If you want to guarantee that duplicate records are output in their original sequence, you must have EQUALS in effect. You can specify EQUALS using:
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum