COBOL Manual for TNS/E Programs (H06.03+)

Procedure Division Verbs
HP COBOL Manual for TNS/E Programs520347-003
9-111
MERGE
Files Specified in the MERGE Statement
You can merge to and from these types of files:
°
Disk files
°
Blocked tape files
°
Multiple-reel tape files
°
Tape files on a multiple-file reel
The files specified in the MERGE statement are subject to these restrictions:
°
Every file record must contain all of the key fields.
°
A file name cannot appear more than once in the same MERGE statement.
°
Two files of a multiple-file tape reel cannot appear in the same MERGE
statement.
°
Files that appear in the same MERGE statement cannot appear in a SAME
AREA or SAME SORT-MERGE AREA clause.
°
Except for merge-out files, files that appear in the same MERGE statement
cannot appear in the SAME RECORD AREA clause.
°
A merge-in-1, merge-in-2, or merge-in-n file whose SELECT clause
includes the OPTIONAL phrase must be present at execution time.
Merge Keys
Each merge key is subject to these restrictions:
°
The data item specified by key must be described within a record associated
with merge-file. When merge-file has more than one record description
entry, a merge key data item can be defined within any one of those entries.
°
No key can have an OCCURS clause or be subordinate to an item that has
an OCCURS clause.
°
No key can have a variable size (that is, have an OCCURS DEPENDING
clause in the description of a subordinate item).
Keys are listed from left to right within the MERGE statement in order of
decreasing significance (that is, the first key is the most significant and the last
key is the least significant). ASCENDING and DESCENDING phrases do not
affect keys’ significance.
When a key is in an ASCENDING phrase, the merged sequence is from the
record with the lowest value in the key to the record with the highest value. When
a key is in a DESCENDING phrase, the merged sequence is from the record with
the highest value in the key to the record with the lowest value. In both cases, the
rules for comparison of operands in a relation condition determine which value is
higher.
The results of the merge operation are predictable only when the records in each
of the input files are ordered as described in the key-specifier phrases.