Gerhard and all following this topic I've tried to develop a complete story in part based on the above extract from the z/OS V1R12 MVS JCL Reference, SA22-7597-14, "12.19.8 Disposition of Partitioned Data Sets (PDSs and PDSEs)":
http://publibz.boulder.ibm.com/cgi- bin/bookmgr_OS390/BOOKS/IEA2B6A0/12.19.8 I start with the simpler case of a sequential data set and go on to a PDS without a member name specified finishing with a PDS with a member name specified. It's very much a requirement that these tables be viewed with a non- proportional font of course. Sequential ---------- JCL --------------------------------------------- | DISP=NEW | DISP=MOD | DISP=OLD | DISP=SHR | --------------------------------------------- | pass | pass | fail | fail | data set does not exist --------------------------------------------- | fail | pass | pass | pass | data set does exist --------------------------------------------- Input --------------------------------------------- | DISP=NEW | DISP=MOD | DISP=OLD | DISP=SHR | --------------------------------------------- | 1 | 1 | -------- | -------- | data set does not exist --------------------------------------------- | -------- | 2 | 2 | 2 | data set does exist --------------------------------------------- 1 - error or immediate EOF 2 - normal with QSAM Output --------------------------------------------- | DISP=NEW | DISP=MOD | DISP=OLD | DISP=SHR | --------------------------------------------- | 2 | 2 | -------- | -------- | data set does not exist --------------------------------------------- | -------- | 3 | 2 | 2 | data set does exist --------------------------------------------- 2 - normal with QSAM 3 - normal with QSAM and data appended PDS with no member name specified --------------------------------- JCL --------------------------------------------- | DISP=NEW | DISP=MOD | DISP=OLD | DISP=SHR | --------------------------------------------- | pass | pass | fail | fail | data set does not exist --------------------------------------------- | fail | pass | pass | pass | data set does exist --------------------------------------------- Note: identical to sequential Input --------------------------------------------- | DISP=NEW | DISP=MOD | DISP=OLD | DISP=SHR | --------------------------------------------- | 1 | 1 | -------- | -------- | data set does not exist --------------------------------------------- | -------- | 4 | 4 | 4 | data set does exist --------------------------------------------- 1 - error or immediate EOF 4 - programming for PDS structure Output --------------------------------------------- | DISP=NEW | DISP=MOD | DISP=OLD | DISP=SHR | --------------------------------------------- | 5 | 5 | -------- | -------- | data set does not exist --------------------------------------------- | -------- | 6 | 5 | 5 | data set does exist --------------------------------------------- 5 - apparently normal with QSAM but creates a sequential data set - or - programming for PDS structure 6 - apparently normal with QSAM but resulting data set is corrupted PDS with member name specified ------------------------------ JCL --------------------------------------------- | DISP=NEW | DISP=MOD | DISP=OLD | DISP=SHR | --------------------------------------------- | pass | pass | fail | fail | data set does not exist --------------------------------------------- | pass | pass | fail | fail | data set does exist but member does not exist --------------------------------------------- | fail | fail | pass | pass | data set does exist and member does exist --------------------------------------------- Input --------------------------------------------- | DISP=NEW | DISP=MOD | DISP=OLD | DISP=SHR | --------------------------------------------- | 1 | 1 | -------- | -------- | data set does not exist --------------------------------------------- | 1 | 1 | -------- | -------- | data set does exist but member does not exist --------------------------------------------- | -------- | -------- | 2 | 2 | data set does exist and member does exist --------------------------------------------- 1 - error or immediate EOF 2 - normal with QSAM Output --------------------------------------------- | DISP=NEW | DISP=MOD | DISP=OLD | DISP=SHR | --------------------------------------------- | 2 | 2 | -------- | -------- | data set does not exist --------------------------------------------- | 2 | 6 | -------- | -------- | data set does exist but member does not exist --------------------------------------------- | -------- | -------- | 7 | 7 | data set does exist and member does exist --------------------------------------------- 2 - normal with QSAM 6 - apparently normal with QSAM but resulting data set is corrupted 7 - normal with QSAM and member replaced My first crack at this tried to give some credence to the assertion provided by Radoslaw Skorupka that DISP always applies to the data set. Then I discovered that the only way to make sense of the section quoted by Gerhard Adam is to assume that - DISP=NEW/MOD insists that the member does not exist irrespective of whether or not a partitioned data set exists - DISP=OLD/SHR insists that the member does exist and obviously the partitioned data set exists which wasted a lot of time but there we are ... Going back to the original question, where a PDS is involved and a member name is specified, DISP=MOD has no special qualities not possessed by DISP=NEW in terms of being accepted in JCL. However, once accepted it looks as if DISP=MOD and "output" is very likely to make a mess of the partitioned data set in the case where a member name is specified and also in the case where a member name is not specified. Bad news all round! - Please those who understand the topic more deeply than I amend as necessary and repost. For example, I am not sure over whether my "1" is an error or regarded as normal but an immediate "end-of-file". This is an opportunity for those who promote testing and have a "sandbox" to hand to show their mettle! Certainly if this had come up twelve years ago or more, I would be reporting test results rather that attempting to work it all out theoretically with assistance from the manuals. Note that DISP=OLD is always the same as DISP=SHR in these diagrams but anyone running through tests might like to verify this. - It's because it is so difficult to be able to find circumstances where a JCL failure applies to DISP=MOD that I'm paying any attention to this thread. I have used the "trick" that DISP=MOD is just immune to ever being the cause of a JCL error - with the exception, easily avoided, described above - as a way to ensure a data set is deleted before allocating the data set anew in a following step. This is a way of setting up trace and dump data sets without running the risk that they may or may not exist prior to running the job. This is usually combined with allocating a trivial amount as a primary and something more substantial as a secondary - with "release" of course - in the job step which may need the trace or dump data set. This is an approach which fits education/test systems but may not suit production systems. There was also often a need to take SYST out of the PPT attributes because of the multiple job step limitation and add TIME=1440 to the step that mattered, of course. Chris Mason On Fri, 4 Mar 2011 16:07:39 -0800, Gerhard Adam <[email protected]> wrote: >Has it occurred to anyone to just look at the JCL Reference manual? > >" When you specify DISP=MOD or DISP=NEW for a partitioned data set (PDS) or >partitioned data set extended (PDSE), and you also specify a member name in >the DSNAME parameter, the member name must not already exist. If the member >name already exists, the system terminates the job. > >When you specify DISP=OLD for a PDS or a PDSE, and you also specify a member >name in the DSNAME parameter, the data set must already exist. If the member >name already exists and the data set is opened for output, the system >replaces the existing member with the new member. If the member name does >not already exist and the data set is opened for output, the system adds the >member to the data set. > >When you specify DISP=MOD for a PDS or a PDSE, and you do not specify a >member name, the system positions the read/write mechanism at the end of the >data set. The system does not make an automatic entry into the directory. > >When you specify DISP=MOD for a PDS or a PDSE, and you do specify a member >name, the system positions the read/write mechanism at the end of the data >set. If the member name already exists, the system terminates the job. > >When you specify DISP=SHR for a partitioned data set extended (PDSE) and >also specify a member name, then: > > * If the member name exists, the member can have one writer or be shared >by multiple readers, or > > * If the member name does not exist, the member can be added to the data >set. Thus, multiple jobs can access different members of the data set and >add new members to the data set concurrently -- but concurrent update access >to a specific member (or update and read by other jobs) is not valid. ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: GET IBM-MAIN INFO Search the archives at http://bama.ua.edu/archives/ibm-main.html

