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 

concurrent update

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


Joined: 22 May 2003
Posts: 8
Topics: 4

PostPosted: Mon Sep 15, 2003 7:05 am    Post subject: concurrent update Reply with quote

What happens in case of concurrent update by multiple users for a sequential file , when that file is being used with DISP=SHR ?

How DISP=SHR is differnet from DISP=OLD in case of updating(writing) a sequential file ?
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Mon Sep 15, 2003 10:54 am    Post subject: Reply with quote

nex,

Any user who is updating the file should have DISP=OLD in their JCL.It gives an exclusive control of the file and no one else can access the file. Any user who is trying to access the file(disp=shr) will be in wait state until the job which is updating the file completes.

Sometimes users code disp=old even when they are just reading the file.This will not allow any other user to access the file.All the other jobs will be in wait state.

Hope this helps...

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Cogito-Ergo-Sum
Advanced


Joined: 15 Dec 2002
Posts: 637
Topics: 43
Location: Bengaluru, INDIA

PostPosted: Mon Sep 15, 2003 11:58 am    Post subject: Reply with quote

Kolusu,
Quote:
Any user who is trying to access the file(disp=shr) will be in wait state until the job which is updating the file completes.


I have had the experience before. I do not think, a user (or, specifically, a job, as per my ecperiments) will wait until some other job completes processing. In my opinion, the data will be all corrupted; there is no guarantee which job will update when.

To test this, I set up this in a single member of my job PDS.
Code:

//XXXXXXXB JOB ,NOTIFY=XXXXXXX       
//*                                 
//HELP     EXEC PGM=SORT             
//SYSIN    DD *                     
 OPTION COPY                         
/*                                   
//SORTIN   DD *                     
REC 1                               
REC 2                               
REC 3                               
REC 4                               
REC 5                               
/*                                   
//SORTOUT  DD DSN=XXXXXXX.DISPSHR.DS,
//            DISP=SHR               
//SYSOUT   DD SYSOUT=*               
//************************************
//**** SECOND JOB STARTS
//**** WILL EXECUTE SIMULTANOUESLY.
//**** NOTE THE EIGHT CHARACTER                                 
//************************************
//XXXXXXXA JOB ,NOTIFY=XXXXXXX       
//*                                 
//HELP     EXEC PGM=SORT             
//SYSIN    DD *                     
 OPTION COPY                         
/*                                   
//SORTIN   DD *                     
REC 6
REC 7
REC 8
REC 9
REC 0

/*                                   
//SORTOUT  DD DSN=XXXXXXX.DISPSHR.DS,
//            DISP=SHR               
//SYSOUT   DD SYSOUT=*               
//*                                 


In my first run, the output was,
Code:

REC 1
REC 2
REC 3
REC 4
REC 5


In the next run, the following was the outoput,
Code:

REC 6
REC 7
REC 8
REC 9
REC 0


Thus, in my opinion, there will not be any wait; but, data integrity goes for a sixer.
_________________
ALL opinions are welcome.

Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Mon Sep 15, 2003 12:35 pm    Post subject: Reply with quote

Quote:

Any user who is updating the file should have DISP=OLD in their JCL.It gives an exclusive control of the file and no one else can access the file. Any user who is trying to access the file(disp=shr) will be in wait state until the job which is updating the file completes.



Cogito: I specifically meant when one of the user codes disp=old while updating the dataset, then all other users who has disp=shr for the same file will be in the wait mode.


Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
slade
Intermediate


Joined: 07 Feb 2003
Posts: 266
Topics: 1
Location: Edison, NJ USA

PostPosted: Mon Sep 15, 2003 1:53 pm    Post subject: Reply with quote

Just one minor clarifying note: if a SHR user job is already using the file, an OLD user job will not be scheduled until the SHR user job ends. So, who waits, depends on who had the file to begin with.

One other thing, though the topic is phys seq files: the VSAM shr options selected when a VSAM file is created will change the update characteristics of a VSAM file when DISP=SHR is used.

Regards, Jack.
Back to top
View user's profile Send private message
Cogito-Ergo-Sum
Advanced


Joined: 15 Dec 2002
Posts: 637
Topics: 43
Location: Bengaluru, INDIA

PostPosted: Mon Sep 15, 2003 10:45 pm    Post subject: Reply with quote

Kolusu,
So, you meant, anyone who is accessing a file with DISP=SHR which is already being used with DISP=OLD elsewhere, will wait. I thought, the block of quote meant only for DISP=SHR between jobs.
_________________
ALL opinions are welcome.

Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes.
Back to top
View user's profile Send private message
nex
Beginner


Joined: 22 May 2003
Posts: 8
Topics: 4

PostPosted: Mon Sep 15, 2003 11:41 pm    Post subject: Reply with quote

Kolusu,
Does that mean , a user cannot update a file at all (either VSAM or sequential) on his end , using DISP=SHR ?
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Sep 16, 2003 5:32 am    Post subject: Reply with quote

Cogito: Disp=old will grant an exclusive control of the file on the job and will not let others use the file. Open a PS file in EDIT MODE and in another session submit a job which copies the same dataset.The job will be in wait state untill you exit out of your edit mode.

Nex: You CAN update the file by coding disp=shr.

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Cogito-Ergo-Sum
Advanced


Joined: 15 Dec 2002
Posts: 637
Topics: 43
Location: Bengaluru, INDIA

PostPosted: Tue Sep 16, 2003 5:48 am    Post subject: Reply with quote

Yes, Sir. That is clear to me. Smile
_________________
ALL opinions are welcome.

Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes.
Back to top
View user's profile Send private message
nex
Beginner


Joined: 22 May 2003
Posts: 8
Topics: 4

PostPosted: Mon Sep 22, 2003 10:00 am    Post subject: Reply with quote

Kolusu,
My question is still unanswered:

Quote:
What happens in case of concurrent update by multiple users for a sequential file , when that file is being used with DISP=SHR ?


Specifically I want to know :
User1 is using the file for update with DISP=SHR and at the same time 2 more users are trying to access the file with DISP=SHR. User2 wants to update the file and User3 wants to just read the file.

Q-1 : Who will be able to update file: User1 or User2 ? Will there be any data corruption in this case or User2 will be able to update the file only after user1 has updated it ?

Q-2: What copy of file will user3 be able to read ; updated one or unupdated or updated till that time ?
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Mon Sep 22, 2003 11:07 am    Post subject: Reply with quote

Nex,

The final data is corrupted.To answer your questions specifically.

Both user1 and user2 will be able to update the file, but there is no gurantee that any of their individual updates will be reflected.

To illustrate this I had 3 jobs all running at the same time on a single file with a volume of 349,793

Job A was updating the bytes in position '1'
Job B was also updating the bytes in position '1' but with a different condition.
Job C is just reading the file.

I ran all the 3 jobs concurrently. I ran all the 3 jobs 4 times to see the pattern of results.The results vary for each run.

Job C sometimes picked up the updates of JOB A but not the updates of JOB B.sometimes JOb C did not read all the records at all. I was missing around 2800 records in the output.When ever I got all the records , I was missing JOb A updates.

JOB C is either reading the unupdated file or even reading the updated file from job B which in turn is overlaying the updates of A since JOb B is working on different condition.

So the final output is always corrupted. So avoid coding DISP=SHR when you really want to update.If you don't care about the integrity of the data then you can go ahead and code disp=shr

Hope this helps...

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
nex
Beginner


Joined: 22 May 2003
Posts: 8
Topics: 4

PostPosted: Tue Sep 23, 2003 12:40 am    Post subject: Reply with quote

All I can say is , Kolusu is just Great. Very Happy

Thanks a trillion Kolusu.
Back to top
View user's profile Send private message
bablack
Beginner


Joined: 04 Dec 2002
Posts: 71
Topics: 0
Location: Little Falls, NJ

PostPosted: Tue Sep 23, 2003 2:24 pm    Post subject: Reply with quote

The IBM manual Using Data Sets has a chapter on sharing non-VSAM datasets and it makes it pretty clear that sequential datasets cannot be shared for update with DISP=SHR unless all programs doing the updates are coded to serialize the updates (using ENQs for the most part).

In z/OS 1.5, due out next year, IBM will ABEND the second user if it tries to OPEN a sequential dataset for OUTPUT with DISP=SHR if some other SHR user already has it open for OUTPUT.
_________________
Bruce A. Black
Senior Software Developer
Innovation Data Processing
Back to top
View user's profile Send private message Send e-mail Visit poster's website
pmcmull
Beginner


Joined: 26 Nov 2003
Posts: 1
Topics: 0

PostPosted: Wed Nov 26, 2003 2:42 pm    Post subject: Reply with quote

Responding to original question:
It's bad practice. Shops that have standards won't let you use JCL statements like that in a production situation. User-submitted is of course another question. Updating should be done with OLD because it does control(eliminate) concurrent update. SHARE should be used for READ only. If fact I'm so used to the rule that my first reaction is that you can't update with SHARE disp.
If different jobs or users are creating data that is supposed to be combined, the usual practice where I am is to each catalog their own dataset, then combine the results to one dataset. Using sortcopy or whatever.
Back to top
View user's profile Send private message
bablack
Beginner


Joined: 04 Dec 2002
Posts: 71
Topics: 0
Location: Little Falls, NJ

PostPosted: Wed Nov 26, 2003 6:01 pm    Post subject: Reply with quote

Quote:
It's bad practice. Shops that have standards won't let you use JCL statements like that in a production situation. User-submitted is of course another question. Updating should be done with OLD because it does control(eliminate) concurrent update. SHARE should be used for READ only. If fact I'm so used to the rule that my first reaction is that you can't update with SHARE disp.


Not strictly true. Load libraries are normally updated with DISP=SHR so that other jobs can continue to execute programs from them. The linkage editor/binder uses a special ENQ/RESERVE to insure that only one program can be updated at a time. If you force them to use DISP=OLD when updating, then the load library could only be updated when noone was using it. Linklist libraries, which are normally ENQed by LLA, could never be updated.

but for datasets without this special protection, you are right.
_________________
Bruce A. Black
Senior Software Developer
Innovation Data Processing
Back to top
View user's profile Send private message Send e-mail Visit poster's website
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