rtamma,
An internal sort is actually done within your Cobol program by using an SD Sort file. You define what fields are to be the sort order and the input and output procedures within this SD statement. The input procedure releases chosen records to the file, and the output procedure returns then to the program for further processing.
An external sort is done outside of your Cobol program by CA-Sort or something similar. The file is then presented to your CObol in sorted sequence.
Pro and cons?
Pros: An internal sort has more control over the records that you are actually going to process, although many of the external sorts do provide the ability to drop records etc.
Cons: Many people do not like the Sort verb as it's a little bit unusual to use, and is far easier to run an external sort if all you require is a sorted file.
It's down to each particular application I guess, although that said I can't remember the last time I coded one!
I'd like to add that, since specialised sorting utilities are usually quite efficient, external sorts often are a lot faster. Moreover, a control card with some parameters for a sorting utility is easier to maintain than a COBOL program. --------
Regards,
Ronald.
On Tandem (Compaq), the SORT environment in COBOL85 uses the best of both options.
I think that the logic for processing records to be sorted and those returning from SORT is best implementated as part of the logic in the COBOL program. On the other hand, sorting can quickly develop into a nightmare when you consider the usage and management of system resources required to process and handle certain amounts of data and temporary files. This is where an external utility is usually the best sorting tool.
On Tandem computers all of this is handled through the traditional COBOL SORT verb. For COBOL85 on Tandem, the SORT verb will actually call the Tandem utility FastSort to do the sort.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.