Internal Sorting Interview Questions


What is the internal sorting?

An internal sort is a method to sort file directly within the program without relying on external utilities.

What are the statements used in internal sorting?

Below statements are used in Internal sort process -

  • SORT Statement
  • RETURN Statement
  • RELEASE Statement
  • MERGE Statement

What is the use of INPUT PROCEDURE in SORT or MERGE?

A procedure is executed for each record of the input file before sorting.

What is the use of OUTPUT PROCEDURE in SORT or MERGE?

A procedure is executed for each record of the sorted file.

SORT Statement -

How is sorting achieved in the COBOL program?

SORT statement is a powerful statement used for sorting files internally within the program.

How many files used in the SORT process?

3 files are used in the sorting process −

  • Input file
  • Work file
  • Output file

MERGE Statement -

How do I merge two files in COBOL?

MERGE statement is used to combine two or more sequentially ordered files into a single, merged, and sequentially ordered output file. The files should be in sorted order according to the ascending or descending key that is common for both files.

How many files used in MERGE process?

The number of files are depending on number of input file. If two input files are used in the merging process −

  • 2 Input files
  • Work file
  • Output file

RELEASE Statement -

What is the use of RELEASE statement in internal sorting?

RELEASE statement is used to send records from the input procedure to a sort work file in the sorting process.

RELEASE Statement -

What is the use of RETURN statement in internal sorting?

RETURN statement transfers records from the final phase of a sorting or merging operation.

Frequently Asked Questions -

Define the INPUT PROCEDURE and OUTPUT PROCEDURE?
What happens during INPUT PROCEDURE and OUTPUT PROCEDURE?

How can sorting be achieved in COBOL?
How does the COBOL program do sort?
In which condition we can perform the SORT operation?
What is the use of the SORT statement in COBOL, and how can it be used to sort data in memory and on disk?

How do I sort two files in COBOL?

Where do we use RELEASE statement?
What is the importance of INPUT PROCEDURE in internal sorting?

Where do we use RETURN statement?
What is the importance of OUTPUT PROCEDURE in internal sorting?