Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Merge processing

The user has the capability of merging from two to 16 sorted input files with the same record format and transferring them to an output file.

Merging takes place in a file called a sort-file. This file is defined in the Data Division within a sort-file description (SD) entry, and in the record description associated with the SD. Merge processing is initiated by means of the MERGE statement in the Procedure Division. The merge operation is performed in three stages:

  1. Release the records of all input files to the sort-file.

  2. Merge the records in the sort-file.

  3. Return all records from the sort-file.

The MERGE statement releases the records of all specified input files to the sort-file. The user can specify an output file into which the MERGE statement returns the merged records. In connection with returning, it is also possible to specify an output procedure. This procedure accepts records from the sort-file and continues processing them.Several merge operations may be specified in a single program.