MERGE

Syntax

── MERGE ─┬─<file title>─┬───────────────────────┬─────────────────────┤
          │              └─<sequence range list>─┤
          └─<sequence range list>──<file title>──┘

Explanation

The MERGE command copies a file into the work file, collating the sequence numbers from both files and preserving the work file records wherever matching sequence numbers occur. A number sign (#) acknowledges completion of the merge.

The <file title> construct specifies the file to be copied into the work file and can be any file to which the user is allowed access.

The <sequence range list> option limits the merge to specific portions of the file. The default is the entire file.

The UPDATE command is implicitly invoked after the MERGE has been executed.

The MERGE command performs the same function as RMERGE except that where sequence numbers coincide, the work file version, rather than the <file title> version, takes precedence.

Example

LIST
100 WORKFILE - LINE 1
200 WORKFILE - LINE 2
300 WORKFILE - LINE 3
400 WORKFILE - LINE 4
#

LIST MERGEFILE
#FILE (USERID)MERGEFILE ON DISK
100 MERGEFILE - LINE 1
150 MERGEFILE - LINE 2
200 MERGEFILE - LINE 3
250 MERGEFILE - LINE 4
#

MERGE MERGEFILE
#UPDATING
#

LIST
100 WORKFILE - LINE 1
150 MERGEFILE - LINE 2
200 WORKFILE - LINE 2
250 MERGEFILE - LINE 4
300 WORKFILE - LINE 3
400 WORKFILE - LINE 4
#