How to merge two separate existing Librarian master files into one existing Librarian master file.
search cancel

How to merge two separate existing Librarian master files into one existing Librarian master file.

book

Article ID: 56676

calendar_today

Updated On:

Products

Librarian

Issue/Introduction

Have 3 Librarian Master files and need to merge 2 of them into the third one. 

Can this be done?   If so, how? 

Environment

Release:  Librarian 4.4

Resolution

In order to merge an existing Librarian master file into another existing Librarian master file, it is a three step Group Processing Option (GPO) process in batch.

In the JCL examples below, the SECOND.EXISTING.MASTERFILE will be the receiving master file.
The FIRST.EXISTING.MASTERFILE is the master file that will be merged into the SECOND.EXISTING.MASTERFILE.

1)  Create a backup of the master file that will hold the other two existing master files:

//* -------------------------------------------------------
//* BKUP1ST: BACKUP THE MASTER FILE THE OTHER MASTER FILES
//* WILL BE COPIED INTO
//* -------------------------------------------------------
//BKUP1ST EXEC PGM=AFOLIBR,PARM='NRJS,NJTA'
//SYSPRINT DD SYSOUT=*
//MASTER DD DISP=SHR,DSN=SECOND.EXISTING.MASTERFILE  
//BACKUP DD DSN=SECOND.EXISTING.MASTERFILE.BACKUP,
//            DISP=(,CATLG),
//            SPACE=(CYL,(xxxx)),UNIT=SYSDA
//LIST   DD SYSOUT=*
//INDEX  DD SYSOUT=*
//OSJOB  DD DUMMY
//SYSIN   DD *
-OPT BKUPDISK
//

 

2)   Run the following GPO job to copy the first Master file into the SECOND.EXISTING.MASTERFILE receiving master file.
//* STEP1 WRITES OUT THE -OPT UTILITY AND -COPY CARDS TO BE USED 
//* AS SYSIN CARDS IN THE NEXT JOBSTEP.
//*
//STEP1 EXEC PGM=AFOLIBR,PARM='NRJS,NJTA'
//SYSPRINT DD SYSOUT=*
//OSJOB DD DSN=&&TEMP1,DISP=(,PASS),DCB=BLKSIZE=800,
// UNIT=SYSDA,SPACE=(TRK,(1,1))
//MASTER DD DSN=FIRST.EXISTING.MASTERFILE,DISP=SHR
//SYSIN DD *
-OPT GPO
-OPT UTILITY
-COPY NAME= ,
-END
//*
//* STEP2 WRITES OUT THE -COPY CARDS TO THE OSJOB DD TO BE USED
//* AS SYSIN CARDS FOR NEXT JOBSTEP . 
//STEP2 EXEC PGM=AFOLIBR,PARM='NRJS,NJTA'
//SYSPRINT DD SYSOUT=*
//OSJOB DD DSN=&&TEMP2,DISP=(,PASS),DCB=BLKSIZE=800,
// UNIT=SYSDA,SPACE=(CYL,(3,3))
//MASTER DD DSN=FIRST.EXISTING.MASTERFILE,DISP=SHR
//SYSIN DD DSN=&&TEMP1,DISP=(OLD,DELETE)
//*
//* STEP3  USES THE -COPY CARDS WRITTEN TO THE OSJOB DATASET
//* IN THE PRIOR JOBSTEP AND WRITES TO THE MASTERFILE
//* SPECIFIED IN THE MASTER DD NAME.
//*
//STEP3 EXEC PGM=AFOLIBR,PARM='NRJS,NJTA'
//SYSPRINT DD SYSOUT=*
//INDEX DD SYSOUT=*
//LIST DD SYSOUT=*
//OSJOB DD DUMMY
//SYSIN   DD DSN=&&TEMP2,DISP=(OLD,DELETE)
//MASTER   DD  DSN=SECOND.EXISTING.MASTERFILE,DISP=SHR
/*
//
 
3)   Rerun the above job and copy the other Master file into the SECOND.EXISTING.MASTERFILE receiving master file.