VMS Help
COBOL, PROCEDURE_DIVISION, MERGE
*Conan The Librarian
|
The MERGE statement takes two or more identically sequenced files and
combines them according to the key values you specify. During the
process, it makes records available, in merged order, to routines in
OUTPUT PROCEDURE or to an output file.
Format -
MERGE mergefile
{ ON { ASCENDING } KEY { mergekey } ... } ...
{ { DESCENDING } }
[ COLLATING SEQUENCE IS alpha ]
USING infile { infile } ...
{ OUTPUT PROCEDURE IS first-proc [ { THRU } end-proc ] }
{ [ { THROUGH } ] }
{ GIVING { outfile } ... }
is a file-name described in a sort-merge file description (SD) entry in
the Data Division.
is the data-name of a data item in a record associated with mergefile.
is an alphabet-name defined in the SPECIAL-NAMES paragraph of the
Environment Division.
is the file-name of an input file. It must be described in a file
description (FD) entry in the Data Division.
is the section-name or paragraph-name of the output procedure's first
(or only) section or paragraph.
is the section-name or paragraph-name of the output procedure's last section
or paragraph.
is the file-name of an output file. It must be described in a file
description (FD) entry in the Data Division.