Copy multiple members from PDS to PANLIB with REPLACE

Document ID : KB000018791
Last Modified Date : 14/02/2018
Show Technical Document Details


Copying from a PDS to a PANLIB is easy using PAN0, unless the members already exist.


Using the PAN0 utility to copy members for a PDS to a PANLIB is documented in

Chapter 4 of the Extended Features Guide, but PAN0 does not recognize REPLACE.

When members pre-exist in the PANLIB, this process can be used:

  1. Get size of current PANLIB - PAN#4 ++ATTRIBUTE
  2. Create new Panlib - PAN#4 ++CLEAR
  3. Copy PDS to new PANLIB - PAN#1 ++USING PAN0, ++ADD
  4. Create protection file - PAN#2 ++DUMP
  5. Copy from new to desired PANLIB - PAN#2 ++REP name1,ZZZZZZZ


  • ++CONTROL may also needed if existing PANLIB is control code protected
    or in steps 1, ,3, 4 and 5 if installation code is used at the site.
  • You cannot replace into the desired PANLIB if the member is in PRODUCTION
    status . Any member(s) that have like names and that are in production
    status in the original PANLIB would need to be renamed.

Sample JCL:

  1. Check the current space allocation
      //STEP   EXEC PGM=PAN#2                                                       //PANDD1   DD DSN=old.panlib,DISP=SHR                                //SYSPRINT DD SYSOUT=*                                                        //SYSPUNCH DD SYSOUT=*                                                        //SYSIN   DD *                                                                ++ATTRIBUTE                                                                   /*
  2. Use the number from that listing on the ++CLEAR
      //STEP     EXEC PGM=PAN#4                                     //SYSPRINT DD SYSOUT=*                                        //PANDD1   DD DSN=NEW.PANLIB,DISP=(,CATLG),         //         UNIT=SYSDA,SPACE=(CYL,(5,1)),                      //         DCB=(DSORG=PS,BLKSIZE=10790),VOL=SER=volser        //SYSIN    DD *                                               ++CLEAR DATASETS=nnnnn        # of members in the new PANLIB      /*
  3. Copy PDS to new PANLIB
      //STEP       EXEC PGM=PAN#1                                 //PANDD1      DD DSN=NEW.PANLIB,DISP=SHR           //PANDD2      DD DUMMY                                       //PANDD3      DD DUMMY                                       //INBPAM      DD DSN=YOUR.INPUT.PDS,DISP=SHR                 //INBSAM      DD DSN=YOUR.INPUT.PDS,DISP=SHR                 //SYSPRINT    DD SYSOUT=*                                    //SYSIN       DD *                                           ++USING PAN0                                                 ++ADD *                     /*
  4. Create protection file - set SPACE on PANDD2 as needed for your site
      //STEP    EXEC PGM=PAN#2                          //PANDD1  DD DISP=SHR,DSN=NEW.PANLIB                                          //PANDD2  DD DISP=(NEW,CATLG),,                        //         DCB=(RECFM=FB,LRECL=80,BLKSIZE=3120),                              //         UNIT=SYSDA,SPACE=(CYL,(?,?))                                       //PANDD3   DD DUMMY                                                           //SYSPRINT DD SYSOUT=*                                                        //SYSPUNCH DD SYSOUT=*                                                        //SYSIN    DD *                                                               ++DUMP                                                                        ++PRINT                                                                       /*
  5. Copy from new to desired PANLIB
      //STEP    EXEC PGM=PAN#2                                                     //SYSPRINT DD  SYSOUT=*                                                       //PANDD1   DD  DSN=old.panlib,DISP=SHR                                        //PANDD2   DD  DUMMY                                                          //PANDD3   DD,DISP=SHR                               //SYSIN    DD *                                                               ++REP name1,ZZZZZZZ                                                               /* 

name1 must be an existing member name. ZZZZZZZZ must be in ascending sequence, but need not be an existing member name.

When this command is processed without any parameters, the latest version of each member on the entire protection file is restored to the PANLIB.