Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cobol 3 conversion

Status
Not open for further replies.

Goutham05

Technical User
Feb 11, 2007
1
US
We have a CB1BATCH program converting to CB3BATCH. There is an internal sort in the program. When we ran the program after compiling with CB3BATCH, the sort output is different than the one woth cb1batch.
The sort order after using WITH DUPLICATES IN ORDER is not same as sort order without using WITH DUPLICATES IN ORDER.

Is there anything we have to do in compile options for oversome this issue?

Thanks
 
I don't know what these programs are that you're using but it is understandable that the data is not in the same order when you use WITH DUPLICATES IN ORDER versus when you don't. THe phrase says to keep records with identical sort key values in the same relative orde r that they were on the input file. When not using the phrase, you can't guarantee what order the records with like keys will be put into the output.
 
The 'computer science' name for this is a [google]stable sort algorithm[/google].

If the sort has the flexibility of producing identicle key value outputs without regard to the relative input order, some efficiencies are obtained by most commercially usable sorting algorithms.

Tom Morrison
 
My experience has been that without DUPLICATES IN ORDER, some sequences of duplicate keyed records are reversed from tnat in the input, others are not.

The easiest algorithm to implement DUPLICATES IN OREDER is to add an input record counter to the end of the internal sort key. If the technical specifications say that with DUPLICATES IN ORDER the maximum length of the sort key is reduced by "n", then this alogorithm is used.

Some sort techniques do not reverse the sequence of input records. The earliest IBM mainframe sort technique, the oscillating sort, did not, but this is a rather ineffecient sort.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top