What we are ending up getting for some sequences is:
FIELD1 FIELD2 FIELD3 FIELD4 FIELD5
---------------------------------------------------
aaaaa 12300
aaaaa 12200
aaaaa 12301
For other cases it does work as well.So its sort of random.
12300 and 12301 are in sequence in the file and also have aaaaa for FIELD1 and would be expected to be together yet on sorting another record with aaaaa for the sort field comes in between in some cases.This seems to differ from the order in which data was in the input file and was released to the SORT area.
I have used cobol sort and JCL SORT(for unsorted detail records without the report headers)+Program to write headers with SORTED data techniques and still find that the final SORT sequence does not necessarily seem to match with the sequence in which the Records get selected frmo the File.
Q>Please let me know if its normal to have SORT pick up at random ie if SORT has 3 records which have same values for the SORT field is it necessary or not that it writes them out in the same order as the came in or is there something wrong with the way I am coding.
This looks something like if SORT was to eliminate duplicates how does it decide which one to pick and which one to eliminate.
Joined: 19 May 2007 Posts: 989 Location: Virginia, USA
Either your sort key is not defined properly or the that data is not as it is shown. Look at the data in hex and see if it is really what you think it is.