You receive message IEC161I 052(013)-084 (RC052 RSN013) when a batch job is trying to open a dataset already open to CICS. The batch job and CICS have no problem sharing the dataset when CICS and the batch job are in separate MVS images. However, you receive the message when running CICS and the batch job in the same MVS image.
VSAM OPEN SFI Reason Code of 013 for Return Code 052 is documented as follows under section 1.130 IEC161I (return code 052) in the z/OS V1R12.0 MVS System Messages, Vol 7 (IEB-IEE) Manual:
|| CRTSKWR - Opening for output, SHR=2,x. Some ACB
already opened the data set for output.
SHAREOPTIONS (2 3) is specified for the file. This means only one job can open the dataset for update in a single MVS image and full sharing is allowed for separate MVS images.
In the working case, where CICS and the batch job are in separate MVS images, it is the second part of SHAREOPTIONS (the 3) that is in effect. This option allows full sharing. In the failing case, where CICS and the batch job are in the same MVS image, it is the first part of SHAREOPTIONS (the 2) that is in effect. The 2 only allows one job to open the dataset for update. But, both CICS and the batch job were attempting to open the file for update.
Resolving the problem
If you need to be able to access VSAM spheres from multiple address spaces with update intent, then the spheres must be accessed using VSAM record-level sharing (RLS) which provides data integrity for multiple CICS and Batch address spaces updating simultaneously.
If an RLS file is defined with LOG(UNDO) or LOG(ALL) in the ICF catalog then it is recoverable. In this case, you must also use DFSMS Transactional VSAM (DFSMStvs) to allow CICS and Batch updates to occur simultaneously with integrity. Without Transactional VSAM only multiple CICS regions can update the RLS file simultaneously.
For more information, see Webcast replay on CICS and Transactional VSAM and section 184.108.40.206 Using VSAM RLS with CICS in the z/OS V1R12 DFSMS Using Data Sets manual.
CICS/TS CICS TS CICS Transaction Server