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.
  • READONLY does not allow any program accessing the target area to write to it. An abend results if a program attempts to write to a READONLY target.
  • SHAREDWRITE allows any sharing program to write to the target. All those sharing the target area instantly receive the updates. This view could be very useful as a communication method for programs.
  • UNIQUEWRITE has the property of copy-on-write, which means that MVS creates a copy of a page for the updating program once the program writes to that page. The only program that has the change is the program that changed it; all others continue to use the original page unmodified. This is true whether the program writes to a source or target page.

    A copy-on-write hardware facility is provided for additional performance improvement. If you need to determine if your processor has the feature, you can use the CVT mapping macro, and test the CVTSOPF bit. For details on the CVT mapping macro, see z/OS MVS Data Areas in the z/OS Internet library.

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.

Specifying RETAIN=NO for an unshare of a E/LSQA or E/SQA view will result in a page that is not backed by real storage. Any subsequent access to the page will result in an 0C4 abend. The page can, however, be the target of a subsequent share. Specifying RETAIN=YES for an unshare of a E/LSQA or E/SQA page will result in a 6C5 abend.