MERGE
The MERGE command copies records from another data set and inserts them in correct key order in the keyed data set being edited. Use the MERGE command only when editing a keyed data set (see also Combining data sets).
Use the MERGE command without parameters to display the Edit COPY screen, described in Edit COPY Screen. Use this screen to specify the source data set and record selection criteria (based on the record contents) shown in Edit COPY Screen.
The command is available in the Edit function in Character and Vertical Formatted modes.
data set
Specifies the name of the data set to use as a source of new records.
Entering the MERGE command while editing a nonkeyed data set produces the message COMMAND NOT SUPPORTED. The command is ignored.
Guidelines
The record key of each merged record is the data in the columns defined as the key field in the edit data set. Therefore, the definition of a record key in the source data set is ignored by the MERGE command.
File-AID determines the position of each new record by scanning the edit data set from the beginning and inserting the new record immediately before the first record with a higher key value. Merging records may result in duplicate key errors, which are marked with the DUP flag.
The key field of a merged record is initially unprotected, to permit the key to be modified. This feature can be used to distinguish between merged records and records that were present prior to the MERGE command by protecting all records with the P (protect) line command before entering the MERGE command. After the merge is completed, the old records can be identified by the highlighted key field; the key field of each merged record is not highlighted.
Data can be merged from any data set or PDS member. If the attributes of the source data set are inconsistent with the attributes of the data set being edited, the Confirm Copy screen is displayed and lists the attributes for both data sets. You may either proceed or cancel the merge operation.
The MERGE command is not permitted if any key sequence errors, marked by the SEQ flag, are present in the edit data set. Entering the MERGE command produces the message: CANNOT MERGE.