sort or merge operations - IBM Mainframe

Arranging records in a particular sequence is a common requirement in data processing. Such record sequencing can be accomplished using sort or merge operations.

  • The sort operation accepts un-sequenced input and produces output in a specified sequence.
  • The merge operation compares records from two or more sequenced files and combines them in order.

COBOL has special language features that assist in sort and merge operations. With VS COBOL II, your IBM sort/merge licensed program must be DFSORT or an equivalent (wherever DFSORT is mentioned, any other equivalent SORT product can be used). COBOL programs containing SORT or MERGE statements can reside above or below the 16-megabyte line. To sort or merge files, you need to do the following:

  • Describe the input and output files, if any, for sorting/merging (FILE-CONTROL and FD entries are needed)
  • Describe sort-files and merge-files (FILE-CONTROL and SD entries are always needed)
  • Specify the sort or merge operation (code SORT or MERGE statements in the Procedure Division)
  • Establish an environment to use the sort product (use appropriate JCL)

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd Protection Status

IBM Mainframe Topics