The MERGECOPY is just opposite of IMAGECOPY. This DB2 utlility is used to combine the multiple image copy datasets into a new full or incremental image copy. This is mainly used to restore the backup in the DB2 table.
The below JCL step can be used for the incremental MERGECOPY for DB2 table TAB1 which is residing in the database DBSET1−
//STEP010 EXEC DSNUPROC //COPY1 DD DSN=TEST.DB2.COPY1,DISP=(MOD,CATLG,CATLG), // UNIT=SYSDA,SPACE=(4000,(20,20),,,ROUND) //COPY2 DD DSN=TEST.DB2.COPY2,DISP=(MOD,CATLG,CATLG), // UNIT=SYSDA,SPACE=(4000,(20,20),,,ROUND) //SYSOUT DD SYSOUT=* //SYSIN DD * MERGECOPY TABLESPACE DBSET1.TBSPAC01 COPYDDN (COPY1,COPY2) NEWCOPY NO
The COPY1 and COPY2 are the incremental image copy datasets. The SYSIN parameter has the statement MERGECOPY TABLES which is followed by the name of tablespace in which the table TB01 resides. The tablespaces have to be qualified by a database name.
The COPYDDN statement is followed by the incremental image copy datasets which need to be combined.
The NEWCOPY NO indicates this is an incremental merge copy. For full merge copy we will use NEWCOPY YES.