Page 1 of 1

Cobol sort key of the input file is same for more than one

PostPosted: Tue Apr 14, 2009 11:21 pm
by swaroopag
Hey,

Im using cobol sort in one program and came across a scenario - where the sort key of the input file is same for more than one records..
in such case, the records should be just written to output file in the order of their occurance in the input file.
But, they are being sorted based on the field right next to the sort-key.. even though Im sorting my records based on only sort key.

The same functionality when done thru Eztrieve program, the input records for duplicate sort key are just being written in the out put file in the order they are read..
Have any of you come across similar situation.. any guess what might be wrong with my cobol porgram..?

really appreciate your response.. thanks a lot

Re: Cobol sort key of the input file is same for more than one

PostPosted: Wed Apr 15, 2009 3:18 am
by dick scherrer
Hello and welceom to the forum,

Suggest you add a "seqnum" field after the sort key. When you issue the sort, sort on both the sort key and this new field.

When a sort is run on the mainframe, the data is sorted by only the sort key. The sequence of the data within an individual key is unpredicatble (unless EQUALS is specified or a sequence number is used).