z/OS DFSMStvs Administration Guide
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


IDALKADD—RLS record locking

z/OS DFSMStvs Administration Guide
GC52-1388-00

The IDALKADD macro is a VSAM RLS and DFSMStvs request macro. Applications or application support packages that perform logging of changes to VSAM data sets, such as CICS® file control, use the IDALKADD macro. With logging, it is necessary to create a log entry before making the corresponding change to the data set or database. The log entry must uniquely identify the inserted, deleted, or changed record. When VSAM rejects an ADD due to a duplicate-key condition, logging an ADD to a KSDS presents a problem. Also, the record identification for an ESDS is the record RBA, and logging an ADD to an ESDS implies that the RBA of the record is known before VSAM actually adds the record. An IDALKADD request addresses these two situations.

Before IDALKADD adds a record to a KSDS, RRDS, or VRRDS, via the base or a path, the macro performs duplicate key or RRN checking. If a record with the specified key or RRN already exists in the base, the IDALKADD macro fails with the duplicate key or RRN error status. If the base data set does not contain a record with the specified key or RRN, IDALKADD obtains a record lock to ensure that no other LUWID application can add a record with this key or RRN. For an IDALKADD SEQ request to add a record to an RRDS sequentially, VSAM assigns and returns the RRN. An IDALKADD request to add a record to an ESDS returns the RBA that will be assigned to the new record, locks the record RBA, and ensures no other LUWID application can add a record that will be assigned that RBA to the ESDS. Upon successful completion of this request, the requestor writes an entry in a recovery log/journal and issues a VSAM PUT RPL OPTCD=(NUP) to add the record to the data set.

The PUT request must use the same RPL as was used by the IDALKADD. The IDALKADD and PUT NUP are a request pair in the same sense as GET UPD and PUT UPD are a request pair. Reuse of the RPL before issuing the PUT NUP cancels the IDALKADD. The length of the record specified on IDALKADD and the subsequent PUT must be the same or the PUT request is rejected with an invalid record length reason code. For a KSDS, RRDS, or VRRDS, the PUT must specify a record with the same base key/RRN as was specified by the IDALKADD request. A commit protocol application must specify the same LUWID in the PUT request as was specified in the paired IDALKADD request.

Even though an IDALKADD is successful, the corresponding PUT NUP may fail. An example of where the PUT NUP would fail is the condition where the PUT NUP would create a duplicate key in an alternate index and the alternate index requires unique keys. In this case, the PUT NUP fails.

IDALKADD is supported for both base and path access. IDALKADD is supported for both recoverable spheres and non-recoverable spheres. It is supported for KSDSs, ESDSs, RRDSs, and VRRDSs.

The record lock acquired by an IDALKADD request is released as follows:
  • Recoverable Sphere

    CICS transactions and batch jobs that use DFSMStvs are allowed to add records to a recoverable sphere. An NSR batch job can add records to a recoverable sphere when the data set is not open for VSAM RLS or DFSMStvs access (for example, it has been quiesced for VSAM RLS and DFSMStvs access). The record lock is released at the end of the transaction.

  • Non-Recoverable Sphere
    The following events release the record lock.
    • The paired PUT NUP is issued and the data CI containing the new record has been written to DASD and the coupling facility.
    • An ENDREQ is issued on the string.
    • The string (RPL) is re-used without issuing the paired PUT NUP.
    • The CICS transaction reaches end-of-transaction.

The keep lock option (KL/NOKL) supported by RLS and DFSMStvs for GET UPD does not apply and is ignored by an IDALKADD request.

VSAM does not support PUT NUP,SEQ in backward processing mode. This also means IDALKADD SEQ,BWD is not supported.

The format of the IDALKADD macro follows.

The format of the IDALKADD macro.
Label Operand Parameters

[label]

IDALKADD

RPL=address

label
specifies 1 to 8 characters that provide a symbolic address for the IDALKADD macro.
RPL=address
specifies the address of the request parameter list that defines this IDALKADD request. You may specify the address in register notation (using a register from 1 through 12, enclosed in parentheses) or specify it with an expression that generates a valid relocatable A-type address constant.
The following RPL parameters apply to this request:
AREA
Contains a copy of the record that will be added to the data set by a PUT NUP request

When you issue IDALKADD to add a record to a KSDS, a record lock is obtained on the specified record. The record lock name is derived from the base key of the record. The base key is extracted from this copy of the record.

AREALEN
Length of the record. The subsequent PUT must specify the same length.
ARG
For an IDALKADD DIR/SKP to a RRDS or an IDALKADD DIR/SKP/SEQ request to a VRRDS, the application provides the RRN of the new record here.
LUWID
LUWID identifies the logical unit of work ID associated with a request to VSAM.

A commit protocol application (for example, CICS) must specify a nonzero value for this parameter. Noncommit protocol applications (for example, batch jobs that are not using DFSMStvs access) and batch applications that are using DFSMStvs access do not specify the LUWID parameter. When RLS access is used, VSAM assigns a single LUWID for all requests issued by a noncommit protocol application. When DFSMStvs access is used, DFSMStvs fills in the LUWID value using the unit of recovery ID obtained from resource recovery services (RRS).

For an ESDS, the IDALKADD request returns the RBA that will be assigned to the record by the subsequent PUT NUP request. The RBA value is returned in field RPLDDDD of the RPL for a non-extended-addressable data set, and in the lower six bytes of the field RPLRBAR for an extended-addressable data set.

For an IDALKADD SEQ to a RRDS, the RPL/string must be positioned to an empty slot. VSAM assigns the RRN of the empty slot to the new record and returns the RRN value in the area pointed to by the RPL ARG parameter.

CICS uses the LUWID parameter to pass a CICS transaction identifier to VSAM RLS. LUWID must not be specified by other (non-CICS) programs.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014