we have a JCL (created from a skel) that has two steps.
First step : check if the dataset is catalogued or not. If, yes it gives a RC=0 and if not, it gived RC=04
second step : it runs only If first step gives RC = 04 (i.e. if the dataset is not found in catalogue). It runs IEFBR14 to allocate the given dataset.
Now, we have come across a situation where the dataset is catalogued and was being used/referred by some other jobs when our job was submitted to run.
So, as soon as we submited the job, it gets dataset contention error due to the 2nd steps code. and do not run the first step at all. It means irrespective of first steps outcome, JCL validation of 2nd step is happening the moment job gets submitted.
Please let me know how to tackle this so that job does not get the contention and 2nd step's validation happens only at the basis of first steps RC=04 as per the IF condition.
Here is the JCL
//LOCN1 EXEC PGM=SULOCATE,
// PARM='/GW.CAP1.CATS.LOAD,RC=04'
//SYSPRINT DD SYSOUT=*
//NWLOC IF LOCN1.RC = 4 THEN
//ALLOC1 EXEC PGM=IEFBR14
//FILE1 DD DSN=GW.CAP1.CATS.LOAD,
// DISP=(NEW,CATLG),
// UNIT=DISK,
// LIKE=GW.CAP1.CATS.PROD.LOAD,
// DSNTYPE=LIBRARY
//NWLOC ENDIF
// PARM='/GW.CAP1.CATS.LOAD,RC=04'
//SYSPRINT DD SYSOUT=*
//NWLOC IF LOCN1.RC = 4 THEN
//ALLOC1 EXEC PGM=IEFBR14
//FILE1 DD DSN=GW.CAP1.CATS.LOAD,
// DISP=(NEW,CATLG),
// UNIT=DISK,
// LIKE=GW.CAP1.CATS.PROD.LOAD,
// DSNTYPE=LIBRARY
//NWLOC ENDIF
Here is the error
IEF677I WARNING MESSAGE(S) FOR JOB P53DS ISSUED
$HASP373 P53DS STARTED - INIT 25 - CLASS M - SYS
ACF9CCCD USERID GBQW IS ASSIGNED TO THIS JOB - AB35DEM
*MIM1040I P53DS WAITING FOR RESOURCES
MIM1038I P53DS JOB00543 A=008E T=7F8058 contention with BCI
MIM1039I P53DS JOB00543 A=008E T=7F8058 needs EXCL SYSDSN J
MIM1038I P53DS JOB00543 A=008E T=7F8058 contention with BCI
MIM1039I P53DS JOB00543 A=008E T=7F8058 needs EXCL SYSDSN J
*MIM1040I P53DS WAITING FOR RESOURCES FOR .7 MINUTES
$HJOB00543
$EJOB00543
$CJOB00543
IEF861I FOLLOWING RESERVED DATA SET NAMES UNAVAILABLE TO GBQW
IEF863I DSN = GW.CAP1.CATS.LOAD P53DS RC = 04 RSN =
*IEF099I JOB P53DS WAITING FOR DATA SETS
$HASP373 P53DS STARTED - INIT 25 - CLASS M - SYS
ACF9CCCD USERID GBQW IS ASSIGNED TO THIS JOB - AB35DEM
*MIM1040I P53DS WAITING FOR RESOURCES
MIM1038I P53DS JOB00543 A=008E T=7F8058 contention with BCI
MIM1039I P53DS JOB00543 A=008E T=7F8058 needs EXCL SYSDSN J
MIM1038I P53DS JOB00543 A=008E T=7F8058 contention with BCI
MIM1039I P53DS JOB00543 A=008E T=7F8058 needs EXCL SYSDSN J
*MIM1040I P53DS WAITING FOR RESOURCES FOR .7 MINUTES
$HJOB00543
$EJOB00543
$CJOB00543
IEF861I FOLLOWING RESERVED DATA SET NAMES UNAVAILABLE TO GBQW
IEF863I DSN = GW.CAP1.CATS.LOAD P53DS RC = 04 RSN =
*IEF099I JOB P53DS WAITING FOR DATA SETS