Batch execution of LIBGET loops

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

Description:

Executing LIBGET in batch seems to loop when a member to be copied already exists on target PO data set.

Explanation:

LIBGET is waiting for user response for whether the member is to be replaced or the request to be cancelled. This cannot be resolved in batch execution. As it is consuming CPU time it appears like being in a loop.

Solution:

One possible solution is shown in the JCL sample below doing the copy to a temporary PDS and use IEBCOPY to add or replace the member on the target PDS.

//BATCHTSO EXEC PGM=IKJEFT01,DYNAMNBR=256
//STEPLIB  DD  DSN=your.LIBR43.SPxx.CAILIB,DISP=SHR
//*
//SYSPROC  DD  DSN=SYS1.CLIST,DISP=SHR
//         DD  DSN=SYS2.CLIST,DISP=SHR
//         DD  DSN=SYS1.PROCLIB,DISP=SHR
//         DD  DSN=SYS2.PROCLIB,DISP=SHR
//         DD  DSN=ISR.V3R1M0.ISRCLIB,DISP=SHR
//         DD  DSN=GIM.SGIMCLS0,DISP=SHR
//         DD  DSN=SYS1.SBLSCLI0,DISP=SHR
//         DD  DSN=user.CLIST,DISP=SHR
//SYSPRINT DD  SYSOUT=*
//SYSTSPRT DD  SYSOUT=*
//SYSTSOUT DD  SYSOUT=*
//SYSTERM  DD  SYSOUT=*
//SYSOUT   DD  SYSOUT=*
//OSJOB    DD  SYSOUT=*
//PERMMSG  DD  SYSOUT=*
//TERMMSG  DD  SYSOUT=*
//TEMPMSG  DD  SYSOUT=*
//INDEX    DD  SYSOUT=*
//SYSTSIN  DD  *
LIBGET memname,DSSOURCE('your.original.master'), +
READONLY,INCLUDE(RESEQ), +
TSODSN(TEMP(newmembr)
/*
//*      the above creates user-prefix.TEMP(DUMPGEN0) (?)
//* ------------------------------------------------------------------ *
//UPDATE   EXEC PGM=IEBCOPY,REGION=1024K
//SYSPRINT DD SYSOUT=*
//SYSUT3   DD  UNIT=DISK,SPACE=(CYL,1)
//SYSUT4   DD  UNIT=DISK,SPACE=(CYL,1)
//AUS1     DD  DSN=your.target.pds,DISP=SHR
//EIN1     DD  DSN=user-prefix.TEMP,DISP=(OLD,DELETE)
//SYSIN    DD  *
 C I=((EIN1,R)),O=AUS1
 S M=(newmembr)
/*
//

Other Relevent Information:

There might be other approaches as well to achieve this, like checking first whether the member already exists on the PO data set and then delete it prior to execute LIBGET, but the given sample is one of the easiest.