WRITE request processing

The course of WRITE request processing depends on the access method, and for VSAM access, on whether the file is a data table.

VSAM processing

  1. The KEYLENGTH is checked for validity. If it is incorrect, the INVREQ condition is raised.
  2. A VSAM work area (VSWA) is created. This includes the request parameter list (RPL) that will be passed to VSAM.

    Different paths are now followed depending on the type of file.

    ESDS file:
    1. If the file is recoverable, or writes are to be journaled:
      1. If this is not the first write of a sequence and the ESDS write lock is being waited for by another transaction, release the lock and end this sequence, logging the completion if recoverable.
      2. If this is (or has become) the first write of a sequence, acquire the ESDS write lock for the data set.
    2. If the file is recoverable, the WRITE ADD request is recorded in the CICS® system log.
    3. If required, the WRITE ADD request is recorded in a user-specified journal.
    4. Any fields in the RPL not supplied when the VSWA was created are completed.
    5. The RPL is set to point to the user-specified data area. If the user specified a record that is too large for the file, the length in the RPL is set to the maximum length, so that the record is truncated.
    6. A VSAM PUT request is issued to write the record.
    7. If the file is recoverable, a CICS record lock is obtained for the record that has just been written. The record lock will be retained until the next syncpoint, in case the transaction writing the record abends and dynamic transaction backout processing has to be performed.
    8. If the file is recoverable, the after-image of the record is logged for forward recovery and a write complete record is written on the system log.
    9. If not a MASSINSERT, the ESDS write lock is released, if held.
    KSDS or RRDS file:
    1. For KSDS requests, the RIDFLD key specified in the request is checked against the key field in the record to be written. (The record is currently in the application FROM data area.) If it does not match, the INVREQ condition is raised.
    2. If the file is recoverable and not in load mode:
      1. A CICS lock is obtained on the record that is to be written, and an attempt is made to read the record (by means of a VSAM GET request) to discover whether it already exists in the file. If it does, the DUPREQ condition will be raised on the write to VSAM.
      2. If the file is a KSDS, and if this request is part of a MASSINSERT, or if a MASSINSERT is in progress, the read is issued with GTEQ to find the next record in the base data set. A lock is created, using the key of this next record, to prevent other transactions from inserting records into the empty range.
      3. If there is no existing record with the given key, the WRITE ADD request to VSAM is recorded in the CICS system log and, if required, in a user-specified journal.
    3. If the file is not recoverable or in load mode, the WRITE request is recorded, if required, in the user-specified journal, and if recoverable a record lock is obtained and the write logged.
    4. Any fields in the RPL not supplied when the VSWA was created are completed.
    5. If a data table is associated with the base cluster (the data table will be a CICS-maintained table, as user-maintained and coupling facility data tables follow a separate processing path which is not described here). a data table pre-add is issued to place the record in the table as a not-yet-valid entry. If the file is recoverable, a record lock is already held; if not, a lock is acquired before the data table service is called.
    6. A VSAM request is issued to write the record.
    7. If the file is recoverable, the after-image of the record is logged for forward recovery.
    8. If required, the after-image is recorded in a user-specified journal.
    9. If the file is a data table, a data table request is issued to complete the add to the data table by validating the record. If a record lock was obtained for a non-recoverable file, it is released.
  3. If the MASSINSERT option has not been specified on the WRITE request, the VSWA for the operation is released.

    If MASSINSERT has been specified, the VSWA is not released, because it is likely to be needed for subsequent WRITE operations. In this case, the end of MASSINSERT processing is notified to VSAM by the CICS UNLOCK function. (See UNLOCK request processing.)

    Specifying MASSINSERT causes exclusive control of the CI to be acquired. Exclusive control is released by issuing an UNLOCK request. To avoid deadlocks, this should be done immediately after the last WRITE MASSINSERT request.

BDAM processing

  1. The KEYLENGTH is checked for validity. If it is incorrect, the INVREQ condition is raised.
  2. The WRITE command input is checked to ensure that MASSINSERT has not been specified—BDAM does not support MASSINSERT processing. If it has, condition INVREQ is raised.
  3. A file I/O area (FIOA) is obtained.
  4. If the file is recoverable, the record to be written is ENQUEUEd on. The lock is retained until the next syncpoint.
  5. The record to be written is copied from the user-supplied data area to the FIOA. If the record is too large, it is truncated.
  6. If the file is recoverable, the request is logged. If required, the request is also recorded in a user-specified journal.
  7. The key field is converted from character string format to binary format, if necessary, and the BDAM I/O request issued.
  8. The key returned by BDAM is converted from binary format to character string format, if necessary, and passed to the application.
  9. A supervisor call (SVC 53) is issued to release BDAM exclusive control, if necessary.
  10. The FIOA is released by using a FREEMAIN request.


dfhs3c00370.html | Timestamp icon Last updated: Monday, 5 June 2017