MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

JCL file lock

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
rsantosh
Beginner


Joined: 20 Dec 2014
Posts: 43
Topics: 10

PostPosted: Thu Oct 16, 2025 12:23 pm    Post subject: JCL file lock Reply with quote

Hello, I have a JCL which has 1st step as wait of 5 minutes. In the next step it reads a file. When I run the job and try to create the same file when the job is in wait period of 5 minutes and next step has not started executing, I sill get dataset contention. Does the job locks the dataset even though the step where it is used has not started executing?
Step01 makes the job wait for 5 minutes. While job is in wait status (STEP02 hasn't started yet) i tried to create HLQ.TEST but received contention. We have JES2. Will I get same issue with JES3?
Code:
//STEP01   EXEC PGM=ZEKESET
//SYSIN DD*
SET WAIT 300
/*
//STEP02 EXEC PGM=IEFBR14
//DD01 DD DSN=HQL.TEST,DISP=SHR
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12388
Topics: 75
Location: San Jose

PostPosted: Thu Oct 16, 2025 10:49 pm    Post subject: Reply with quote

rsantosh,

DISP=SHR will NOT cause an exclusive lock. Some other job/user is holding the job. When you received contention message , issue the command shown below and press enter. It will show the EXCLUSIVE lock in RED
Code:

DDLIST E 'dataset.name.here'

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
rsantosh
Beginner


Joined: 20 Dec 2014
Posts: 43
Topics: 10

PostPosted: Thu Oct 16, 2025 11:36 pm    Post subject: Reply with quote

I submitted the job and while it was in wait status, I issues the ddlist e command. The job didn't have exclusive lock on HLQ.TEST but when I tried to create the dataset with 3.2 I received below message, the jobname shown by the message is the same job which I submitted and was in wait step.
Code:
DATASET IS ALLOCATED TO ANOTHER JOB OR USER
IEFA110I DATA SET CONTENTION
DATA SET HLQ.TEST IN USE BY
SYSNAME  JOBNAME  ASID
XXXX     HLQ1     XXXX
Regards,Santosh
Back to top
View user's profile Send private message
rsantosh
Beginner


Joined: 20 Dec 2014
Posts: 43
Topics: 10

PostPosted: Thu Oct 16, 2025 11:38 pm    Post subject: Reply with quote

Just to add the job ended with JCL error because the data set HLQ.TEST was not found. Due to contention I couldn't create the data set Regards, Santosh
_________________
Regards, Santosh
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12388
Topics: 75
Location: San Jose

PostPosted: Fri Oct 17, 2025 11:00 pm    Post subject: Reply with quote

rsantosh,

Is your system part of sysplex ? If so you need to ensure that the dataset is NOT shared across systems. Assuming you have authorization for /D XCF command from SDSF and it will show you names.
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
rsantosh
Beginner


Joined: 20 Dec 2014
Posts: 43
Topics: 10

PostPosted: Sat Oct 18, 2025 11:25 pm    Post subject: Reply with quote

Hello Kolusu, I checked, the LPAR is part of sysplex. How can I check if dataset is not shared across systems? If it is shared, will SHR not work the way it is supposed to work?
_________________
Regards, Santosh
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12388
Topics: 75
Location: San Jose

PostPosted: Mon Oct 20, 2025 11:00 pm    Post subject: Reply with quote

rsantosh,

If an LPAR is holding the dataset exclusively , then it means someone coded DISP=OLD or they creating the dataset and the task is still running. So you need to find out the job/task that is issuing the exclusive lock.

Search for the dataset name across the proclib/JCL libraries.
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
rsantosh
Beginner


Joined: 20 Dec 2014
Posts: 43
Topics: 10

PostPosted: Tue Oct 21, 2025 2:23 am    Post subject: Reply with quote

Hello Kolusu, There is no other task/job holding the dataset I coded. I am not using any generic dataset name. For testing purpose I used my TSO ID only so that no one else can use it.
Instead of 3.2, I submitted below job in order and 2nd job showed the error message.
Job # 1
Code:
 //XYZ1 JOB                                                                                                                                                   
//STEP01   EXEC PGM=ZEKESET
//SYSIN DD*
SET WAIT 300
/*
//STEP02 EXEC PGM=IEFBR14
//DD01 DD DSN=XYZ.TEST,DISP=SHR
Job # 2
Code:
 //XYZ2 JOB
//STEP02 EXEC PGM=IEFBR14
//DD01 DD DSN=XYZ.TEST,DISP=(NEW,CATLG,DELETE),
//        DCB=(RECFM=FB,LRECL=80),
//        SPACE=(TRK,(1,1))
 
Code:
 IEF861I FOLLOWING RESERVED DATA SET NAMES UNAVAILABLE TO XYZ2
IEF863I DSN=XYZ.TEST XYZ2 RC=04 RSN=00000000 FROM SERVICE ENQ
As soon as job 1 i.e XYZ1 failed with JCLERROR(XYZ.TEST DATASET NOT FOUND) the 2nd job XYZ2 completed successfully creating the dataset
_________________
Regards, Santosh
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group