Merging Data Sets


Summary

For basic information, go through the IEBCOPY Utility (for Beginners)

  • IEBCOPY can perform the merge operation to merge the datasets.
  • Data sets merge by copying or loading the additional members to an existing PDS.
  • Ordering of the output data set after merge can be done automatically.

Practical Example -


Scenario - Re-create or Load a PDS from unloaded PS.

JCL -

----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
***************************** Top of Data ******************************
//MATEPKM  JOB (123),'MTH',CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),           
//             NOTIFY=&SYSUID                                           
//****************************************************                  
//* TO MERGE MANY TO ONE PDS                                            
//****************************************************                  
//STEP50   EXEC PGM=IEBCOPY                                             
//SYSPRINT DD SYSOUT=*                                                  
//SYSOUT   DD SYSOUT=*                                                  
//SYSDUMP  DD SYSOUT=*                                                  
//INPPDS1  DD DSN=MATEPK.IEBCOPY.INPPDS,DISP=SHR                        
//INPPDS2  DD DSN=MATEPK.IEBCOPY.INPPDS1,DISP=SHR                       
//OUTPDS   DD DSN=MATEPK.IEBCOPY.OUTPDS,DISP=OLD                        
//SYSIN    DD *                                                         
    COPY  OUTDD=OUTPDS                                                  
          INDD=INPPDS1                                                  
          INDD=INPPDS2                                                  
/*                                                                      
**************************** Bottom of Data ****************************

Job Status -

Merge Job Status

Output -

Merge Output

Explaining Example -

  • INPPDS1 DD DSN=MATEPK.IEBCOPY.INPPDS,..
    INPPDS2 DD DSN=MATEPK.IEBCOPY.INPPDS1,..
    - Specifies the input PDS file.
  • OUTPDS DD DSN=MATEPK.IEBCOPY.OUTPDS - Specifies the output PDS.
  • COPY OUTDD=OUTPDS
    INDD=INPPDS1
    INDD=INPPDS2
    - Specified INPPDS1, INPPDS2 are inputs and OUTPDS is output.