COBOL Manual for TNS and TNS/R Programs

Procedure Division Verbs
HP COBOL Manual for TNS and TNS/R Programs522555-006
9-122
MERGE
Usage Considerations:
Placement of MERGE Statements
A MERGE statement cannot appear in the Declaratives Portion of the Procedure
Division.
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.