After doing an INIT and RETIX or LOAD in a DBUTLTY step, a REPORT AREA=IXX in a subsequent step in the same job gets error:
DB13001E - UNEXPECTED RETURN CODE 74 (81) OPEN ALLOCATION ERROR
In the MUF Errors:
DB01401E - MVS DYNAMIC ALLOCATION ERROR, DDNAME=IXX001 , R15=4, ERROR=0210, INFO=0000
DB00501E - OPEN ERROR - RETURN CODE 74 (081) CXX=DVCXX IXX00001
Why does the report get a return code 74(81) when the file exists?
The dynamic allocation error code in the MUF is 0210 - Requested data set unavailable. It means the dataset is allocated to another job and it's usage attribute conflicts with this request.
The problem occurs if the file is allocated with DISP=NEW in one step in the job, and the same file is allocated in subsequent steps with DISP=SHR to perform other DBUTLTY functions. If functions like REPORT AREA=IXX is invoked which needs to run under the MUF, then the MUF will try to allocate and open the file.
The allocation error occurs because the batch job still has exclusive control of the file, so the MUF cannot allocate it. This is due to a z/OS restriction. When a step allocates a file with DISP=NEW it will hold on to it until the job ends even if subsequent steps specify DISP=SHR. In the IBM documentation on the DISP Parameter it states:
"When any step of a job requests exclusive control of a data set, with an exception of when the job is allowed to downgrade ENQs via the DSENQSHR specification, the system converts all requests for shared control of that data set within that job (DISP=SHR) to requests for exclusive control. One of two methods can be used to request exclusive control: DISP=NEW, DISP=MOD, or DISP=OLD on a JCL request."