Explain the difference between an internal and an external sort, the pros and cons, internal sort syntax etc?

An external sort is not COBOL; it is performed through JCL and PGM=SORT. It is understandable without any code reference. An internal sort can use two different syntaxes: 1.) USING, GIVING sorts are comparable to external sorts with no extra file processing; 2) INPUT PROCEDURE, OUTPUT PROCEDURE sorts allow for data manipulation before and/or after the sort.

Showing Answers 1 - 34 of 34 Answers

praleo

  • Jul 12th, 2006
 

External sort is performed by SORT pgm. Internal sort gives you data handling flexibility and it takes less secondary memory. For huge Volume of files it's better to use internal sort else large amount of space will be required in external sort. any comments...? 

bala_alias

  • May 11th, 2007
 

external sorting is used to refer to the sorting of huge volumes of data where the available main memory is not enough to handle the data. internal sorting is used for small volumes of data..
 ext sorting is mostly less efficient

  Was this answer useful?  Yes

neha

  • Oct 4th, 2007
 

1. Internal sort is used in COBOL application prog while external sort is used in JCL.

2. Internal sort uses workfiles while external sort uses the DFSORT mechanism.

3. External sort is more complicated than internal sort.

4. Internal sort is more flexible as we can alter or update data before  and after performing internal sort whereas the same doesn't hold true for external sort.

Thanks
Neha

lfrank

  • Jan 8th, 2008
 

This has long been a question as it relates to efficiency. The answer really depends on how much data needs to be sorted. The internal sort is simply an invocation of the same SORT utility that is JCL initiated (external sort).

When you run an external sort, the entire address space is dedicated to the sort process. This means that, outside the sort program itself, all of the storage is used for buffers for the sort strings.

With an internal sort, less storage is available to the sort since the application program and any other elements (DB2, MQ, etc.) take up some of that storage.

If the amount of data is small, the difference in available storage is insignificant. The sort will run just as fast. In fact, doing all the work in a program can be more efficient because the JCL allocation/deallocation steps are done once instead of once for the sort step and once for the program step.

  Was this answer useful?  Yes

An external sort is not COBOL; it is performed through JCL and PGM=SORT.  It is understandable without any code reference.  An internal sort can use two different syntaxes: 1.) USING, GIVING sorts are comparable to external sorts with no extra file processing;  2) INPUT PROCEDURE, OUTPUT PROCEDURE sorts allow for data manipulation before and/or after the sort.

  Was this answer useful?  Yes

vukoti1229

  • Jun 16th, 2008
 

Whenever you are going to manipulate any records befor sorting we are going for Internal sort..
If we dont have anything to manipulate we will go for external sort.....

  Was this answer useful?  Yes

Rinkoj

  • Jul 29th, 2008
 

COBOL sort is external sort as it requires workfile to store intermediate sort data.
Syntax:

SORT WORKFILE KEY IS EMP_NO USING INFILE GIVING OUTFILE.

INFILE  -- Input file
WORKFILE -- Intermediate file where sort data will be stored
OUTFILE  -- completely sorted file.

  Was this answer useful?  Yes

Basically following is the difference between internal sort & external sort
-The internal sorting can reside in main memory, external use secondary memory, i.e. work files.
-Internal sorting is independent of time to read/write a record, external ids dependent on the same because of secondary memory usage.
-Internal sorting takes input only which can be fit into its memory, i.e. it takes small input,
whereas external sorting can take as much as large input.

memays

  • Apr 30th, 2009
 

Actually, Internal and External sort execute the same program (SORT) and utilize the same workfiles.  The difference is in how the I/O is performed.  External sort utilizes it's own I/O routines, whereas Internal sort utilizes COBOL's I/O, and uses an "Exit" (E15/E35) to pass the data to/from the SORT program.

  Was this answer useful?  Yes

rahul

  • Dec 7th, 2014
 

Internal sorting is used to arrange a certain order in RAM or else we can say primary memory while external sorting is to sort order of external memory for huge data

  Was this answer useful?  Yes

Kirk

  • Aug 8th, 2015
 

Internal sort uses the compilers internal sort features. External sort calls 3rd party utility sort feature.
External sort feature is usually used for LARGE volume of data.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions