Page 1 of 1

What will happen if I use Disp=Shr in the output file?

Posted: Thu Nov 17, 2022 6:23 pm
by LalitKumar
Hi,

What will happen if I use Disp=Shr in the output file? Will it act as DISP=NEW or MOD or something else?

Re: What will happen if I use Disp=Shr in the output file?

Posted: Thu Nov 17, 2022 8:41 pm
by Robert Sample
It will act as DISP=SHR. When you use this construct, you are telling z/OS that the data set exists already and that you will allow other address spaces access to the data set while you are accessing it. DISP=NEW indicates that the data set does NOT already exist, and DISP=MOD indicates that the data set already exists and that you are appending data to the end of the data set -- neither of these apply in your case.

Depending upon your site, and the type of data set, your write may fail with the system telling you write access is not allowed, or you may be able to write to the data set with unknown impact to other address spaces accessing the data set. In no case is it a good idea to use DISP=SHR when writing output to the data set.

Re: What will happen if I use Disp=Shr in the output file?

Posted: Fri Nov 18, 2022 1:15 pm
by LalitKumar
Thanks Robert. So if I have a COBOL program which uses DISP=SHR but opens the file in output mode, is this allowed?