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 

Can Two people write to the same DISP=SHR file at once?

 
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
Sysaron
Beginner


Joined: 22 Feb 2004
Posts: 3
Topics: 3
Location: Los Angeles

PostPosted: Sun Feb 22, 2004 6:39 pm    Post subject: Can Two people write to the same DISP=SHR file at once? Reply with quote

What will the result be if they access/write at same time?
Back to top
View user's profile Send private message
[bond]
Beginner


Joined: 31 Dec 2002
Posts: 28
Topics: 6

PostPosted: Mon Feb 23, 2004 12:17 am    Post subject: Reply with quote

Quote:
SHR

Indicates that the data set existed prior to this job step and that
another job can share it while this job step uses it. "SHARE" can be
used instead of "SHR".


Both the jobs can 'access' the file at the same time. However, if one jobs starts 'writing' into the file, the job gets exclusive access to the file (as good as DISP=OLD) and the second job has to wait until the first job finishes. Try to verify this. I may be wrong.
Back to top
View user's profile Send private message
coolman
Intermediate


Joined: 03 Jan 2003
Posts: 283
Topics: 27
Location: US

PostPosted: Mon Feb 23, 2004 1:34 am    Post subject: Reply with quote

Data will get corrupted.

Cheers,
Coolman
________
Hondamatic history


Last edited by coolman on Sat Feb 05, 2011 1:34 am; edited 1 time in total
Back to top
View user's profile Send private message
Maton_Man
Beginner


Joined: 30 Jan 2004
Posts: 123
Topics: 0

PostPosted: Mon Feb 23, 2004 6:19 pm    Post subject: Reply with quote

Bond is right, Coolman is misinformed.
_________________
My opinions are exactly that.
Back to top
View user's profile Send private message
Maton_Man
Beginner


Joined: 30 Jan 2004
Posts: 123
Topics: 0

PostPosted: Mon Feb 23, 2004 6:23 pm    Post subject: Reply with quote

Let me clarify that...

If two people are trying to write to a file allocated DISP=SHR in batch then the first person will get to make their changes while the second one waits, as described by Bond. However, the second person will get their go when the first person is finished writing to the data set and the result may well be the one described by Coolman. You will never get two people writing *simultaneously* to the same data set even if it is allocated DISP=SHR.
_________________
My opinions are exactly that.
Back to top
View user's profile Send private message
semigeezer
Supermod


Joined: 03 Jan 2003
Posts: 1014
Topics: 13
Location: Atlantis

PostPosted: Tue Feb 24, 2004 12:39 am    Post subject: Reply with quote

Quote:

You will never get two people writing *simultaneously* to the same data set even if it is allocated DISP=SHR

Not necessarily true. If the dataset is accessed via BSAM, then you can use NOTE and POINT to specify where in the data set to write. Two programs could update different parts of the dataset simultaneously if opened for update in place. I doubt that occurs much, but it is, or at least used to be theortetically possible. Of course, now if two address spaces open a PDS for output at the same time, the 2nd one will be abended with a 213-50 but sequential data sets are not similarly protected. And if you go down to the EXCP level, you can probably do anything you want.

Also, what about VSAM files? I think they can be safely simultaneously updated with record level locking.
(NB: I've not done any EXCP or VSAM programming, so the above is speculation)
Back to top
View user's profile Send private message Visit poster's website
Maton_Man
Beginner


Joined: 30 Jan 2004
Posts: 123
Topics: 0

PostPosted: Wed Feb 25, 2004 9:14 pm    Post subject: Reply with quote

Ok. Maybe I was a bit hasty...read the DFSMS: Using Data Sets manual and search on DISP=SHR. You will find lots of information on it.

Basically, what I said is true if you do what you're supposed to do (use proper system controls and access methods). That being said if you break 'the rules' or operate outside those controls you could end up with a corrupted mess.
_________________
My opinions are exactly that.
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