View previous topic :: View next topic
|
Author |
Message |
sheersh
New User
Joined: 24 May 2008 Posts: 17 Location: Gurgaon
|
|
|
|
I am updating a VSAM file with DISP=OLD via cobol program. same file is used in many jobs as DISP=SHR (read only) though out the day. I understand if say 20 jobs are using file in DISP=SHR and my update job comes in queue, it will wait till those 20 jobs are finished.
suppose another 10 jobs with DISP=SHR for same file come to queue while update jobs is waiting to finish first lot of the jobs? would they jump the queue and get access before DISP=OLD or first my update job will run and then rest of the read jobs? |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
The answer is....
or first my update job will run and then rest of the read jobs?
Your Job will enqueue the dataset. Any job after that will wait on your job. |
|
Back to top |
|
|
steve-myers
Active Member
Joined: 30 Nov 2013 Posts: 917 Location: The Universe
|
|
|
|
I'm pretty sure Mr. Porcelan's description is correct. I think I have seen this behavior myself. But is there any formal statement this is the correct behavior? To my mind it violates the concept of DISP=SHR. I always thought the running DISP=SHR jobs should block the DISP=OLD job, but the queued DISP=OLD job should not block new DISP=SHR jobs.
I grant there is also a fair argument that the queued DISP=OLD job should block new DISP=SHR jobs as Mr. Poreclan and I both observed, but is this actually documented? I recall wondering about this something like 20 years ago, but I don't think I ever researched it. I can say the antique JCL Reference manual I just looked at seems to be silent about this. |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
I just ran a TEST (imagine that) to confirm my answer.
I does indeed work as expected. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
The z/OS 2.1 JCL User's Guide says on page 110
Quote: |
Exclusive control of a data set
When a job has exclusive control of a data set, no other job can use that data set until completion of the last step in the job that refers to the data set except when downgrading ENQs. A job should have exclusive control of a data set in order to modify, add, or delete records. |
and on page 111:
Quote: |
The job receives control of the data set if:
v Another job is not using the data set.
v Another job is using the data set but both the job requesting the data set and the job using the data set request shared control and no exclusive requests are pending.
The job does not receive control of a data set if:
v Another job is using the data set and that job has exclusive control.
v Another job is using the data set, with either exclusive or shared control, and this job requests exclusive control.
v Another job is using the data set, with shared control, and yet another, earlier job requests exclusive control.
If a job requests data sets that are not available, the system issues the message ‘JOB jjj WAITING FOR DATA SETS’ to the operator. The job waits until the required data sets become available, unless the operator cancels the job. |
|
|
Back to top |
|
|
sheersh
New User
Joined: 24 May 2008 Posts: 17 Location: Gurgaon
|
|
|
|
thanks guys. it helps! |
|
Back to top |
|
|
UmeySan
Active Member
Joined: 22 Aug 2006 Posts: 771 Location: Germany
|
|
|
|
@ sheersh
Just my two cent too:
Also think about the vsam share levels. Parallel updates. I come across this, because you told that the same file is used in many jobs with DISP=SHR.
Second point: Is your site using any job scheduling system like OPC ore something else. In OPC (TWS) you could block access via a SpecialResource statment. |
|
Back to top |
|
|
sheersh
New User
Joined: 24 May 2008 Posts: 17 Location: Gurgaon
|
|
|
|
@ UmeySan - thanks. Yes i have considered share levels and mine would be the only jcl updating the file, rests all will be reading it. We do use CA7 and can set up file /resource requirement but that need to be set on all jobs .. while I can easily set it for my new job. there are thousands of jobs which are already in production and not practical to update scheduling for all. |
|
Back to top |
|
|
UmeySan
Active Member
Joined: 22 Aug 2006 Posts: 771 Location: Germany
|
|
|
|
Sorry about that. I'm only common to OPC, where you can specify this based on particular job without having to modify any other existing jobs jobs. |
|
Back to top |
|
|
|