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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sort

Status
Not open for further replies.

rtamma

Programmer
May 16, 2002
5
US
Can someone please tell me the differences between the internal and external sort . Advantages and disadvantagesof both.
Thanks
RTamma
 
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!

HTH
Marc
 
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top