z/OS DFSMS Using Data Sets
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Cross-Region Sharing

z/OS DFSMS Using Data Sets
SC23-6855-00

To maintain write integrity for the data set, your program must ensure that there is no conflicting activity against the data set until your program completes updating the control interval. Conflicting activity can be divided into two categories:

  1. A data set that is totally preformatted and the only write activity is update-in-place.

    In this case, the sharing problem is simplified by the fact that data cannot change its position in the data set. The lock that must be held for any write operation (GET/PUT RPL OPTCD=UPD) is the unit of transfer that is the control interval. It is your responsibility to associate a lock with this unit of transfer; the record key is not sufficient unless only a single logical record resides in a control interval.

    The following is an example of the required procedures:

    1. Issue a GET for the RPL that has the parameters OPTCD=(SYN,KEY,UPD,DIR),ARG=MYKEY.
    2. Start of change Determine the RBA of the control interval (RELCI) where the record resides. This is based on the RBA field supplied in the RPL. For extended-addressible data sets, this would be the lower six bytes of the field RPLRBAR; for non-extended-addressable data sets, it would beRPLDDDD.
         RELCI=CISIZE * integer-part-of (RPLDDDD / CISIZE)
      End of change
    3. Enqueue MYDATA.DSNAME.RELCI (the calculated value).
    4. Issue an ENDREQ.
    5. Issue a GET for the RPL that has the parameters OPTCD=(SYN,KEY,UPD,DIR),ARG=MYKEY. This action will do I/O and get a refreshed copy of the buffer.
    6. Start of change Determine the RBA of the control interval (RELCI) where the record resides. This is based on the RBA field supplied in the RPL. For extended-addressable data sets, this would be the lower six bytes of the field RPLRBAR; for non-extended-addressable data sets, it would beRPLDDDD. .
         RELCI = CISIZE * integer-part-of (RPLDDDD / CISIZE)
      Compare the calculated values. If they are equal, you are assured the control interval has not moved. If they are not equal, dequeue resource from step "c" and start over at step "a". End of change
    7. Issue a PUT for the RPL that has the parameters OPTCD=(SYN,KEY,DIR,UPD). This does not hold position in the buffer. You can do one of the following:
      • Issue a GET for the RPL that has the parameters OPTCD=(SYN,KEY,UPD,DIR),ARG=MYKEY. This will acquire position of the buffer.
      • Issue a PUT for the RPL that has the parameters OPTCD=(SYN,KEY,DIR,NSP). This does hold position in the buffer.
    8. Issue an ENDREQ. This forces I/O to DASD, will drop the position, and cause data buffer invalidation.
    9. Dequeue MYDATA.DSNAME.RELCI.
  2. A data set in which record additions and updates with length changes are permitted.

    In this case, the minimum locking unit is a control area to accommodate control interval splits. A higher level lock must be held during operations involving a control area split. The split activity must be serialized at a data set level. To perform a multilevel locking procedure, you must be prepared to use the information provided during VSAM JRNAD processing in your program. This user exit is responsible for determining the level of data movement and obtaining the appropriate locks.

    Higher concurrency can be achieved by a hierarchy of locks. Based on the particular condition, one or more of the locking hierarchies must be obtained.
    Lock Condition
    Control Interval Updating a record in place or adding a record to a control interval without causing a split.
    Control Area Adding a record or updating a record with a length change, causing a control interval split, but not a control area split.
    Data Set Adding a record or updating a record with a length change, causing a control area split.
    The following is a basic procedure to provide the necessary protection. Note that, with this procedure, all updates are locked at the at the data set level:
       SHAREOPTION = (4 3)           CBUF processing
       Enqueue MYDATA.DSNAME         Shared for read only;
                                     exclusive for write
       Issue VSAM request macros
            ...
       Dequeue MYDATA.DSNAME

    In any sharing situation, it is a general rule that all resources be obtained and released between the locking protocol. All positioning must be released by using all direct requests or by issuing the ENDREQ macro before ending the procedure with the DEQ.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014