How to share and unshare data

With the IARVSERV macro, use the SHARE parameter to initiate sharing of data; use the UNSHARE parameter to end sharing for the issuing program. This information discusses the additional IARVSERV parameters that you can specify with SHARE or UNSHARE.

The RANGLIST parameter is always required for both SHARE and UNSHARE. It gives IARVSERV information about the source and target addresses. The RANGLIST value is actually the address of the list of addresses you must create using the mapping macro IARVRL. For the details of IARVRL, see z/OS MVS Data Areas in the z/OS Internet library. The following table lists the required IARVRL fields that you must supply for SHARE or UNSHARE.

IARVRL Fields That You Must Initialize for SHARE IARVRL Fields That You Must Initialize for UNSHARE

VRLSVSA
VRLSSTKN (for STOKEN)
VRLSALET (for ALET)
VRLNUMPG
VRLTVSA
VRLTSTKN (for STOKEN)
VRLTALET (for ALET)

VRLNUMPG
VRLTVSA
VRLTSTKN (for STOKEN)
VRLTAKET (for ALET)

For IARVSERV SHARE, if the target area contains pages that belong to an existing sharing group, MVS™ performs an implicit UNSHARE to pull those pages out of the existing sharing group before proceeding. Also, MVS automatically performs an UNSHARE on any sharing page when the page is being freed by FREEMAIN, STORAGE RELEASE, or DSPSERV DELETE, or when the page's address space is ended.

Also, when MVS finds that one page of a range is not acceptable for sharing, MVS will not complete the SHARE request for that page, nor the rest of the range or ranges not already processed. You can assume that all pages up to that point were processed successfully. An abend will be issued and GPR 2 and 3 will contain the address range list associated with the error page and the storage address of the page in error, respectively. To remove the SHARE on the successful pages, issue IARVSERV UNSHARE for the storage ranges up to, but excluding, the error page.

The parameter TARGET_VIEW is required with SHARE only, to tell IARVSERV how you plan to share the data contained in the source. You have three choices described in Defining storage for sharing data and access.

RETAIN is a parameter available only with UNSHARE. RETAIN=NO requests that MVS remove the target from sharing. The target data is lost. RETAIN=YES requests that MVS leave the data in the target untouched.