View previous topic :: View next topic |
Author |
Message |
ANDY Beginner

Joined: 07 Feb 2004 Posts: 127 Topics: 67
|
Posted: Tue Aug 03, 2004 9:11 pm Post subject: DISP=OLD vs DISP=SHR |
|
|
I open a file as output in cobol program, In JCL, what's the difference between DISP=old and DISP=shr for using the file? _________________ cheers,
Andy |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
|
Back to top |
|
 |
ANDY Beginner

Joined: 07 Feb 2004 Posts: 127 Topics: 67
|
Posted: Wed Aug 04, 2004 10:55 pm Post subject: |
|
|
kolusu:
Thanks for your reminder. But I do not get answer from old topic. I know this is a simple question and I know the difference as you explain before and by reference. What I really want to make clear is that if the dataset has data, when we access it for output, the old data will be deleted or not? What's its effective by using shr and old? _________________ cheers,
Andy |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Thu Aug 05, 2004 5:13 am Post subject: |
|
|
Andy,
Quote: |
when we access it for output, the old data will be deleted or not?
|
If you access DSN as output, the old data will be DELETED. This is true for both DISP=OLD & DISP=SHR
The difference between DISP=OLD and DISP=SHR is the exclusive lock.
With DISP=OLD, you will get exclusive hold of DSN for the entire duration of the Job. It prevents other jobs from accessing the DSN while you are modifying it.
With DISP=SHR, the file can be accessed by others while you are modifying it. This will result in reading of corrupt data.
SO it is always advised to code DISP=OLD for output datasets.
In z/OS 1.5, 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.
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
ANDY Beginner

Joined: 07 Feb 2004 Posts: 127 Topics: 67
|
Posted: Thu Aug 05, 2004 7:43 pm Post subject: |
|
|
Dear Kolusu:
Thank you. _________________ cheers,
Andy |
|
Back to top |
|
 |
|
|