Previous Topic: Locking RecordsNext Topic: Collecting Database Statistics


Implicit Record Locks

If your run unit executes through central version and readies an area in shared update, the DBMS acquires implicit records locks in order to control concurrent access to data. It may acquire record locks for other ready modes, depending on the mode and the setting of lock-related system generation parameters.

For a complete discussion of when record locks are acquired, see the CA IDMS Database Administration Guide.

Implicit Shared Locks

Shared locks are placed on record occurrences that are current of record type, set, area, and run unit and are held until a record occurrence is no longer current.

Implicit Exclusive Locks

Exclusive locks are placed on record occurrences that are updated by your application. As you issue DML verbs that update the database, the DBMS acquires these exclusive locks and holds them until you commit or rollback your changes. They prevent other database sessions that are not sharing your run unit's transaction from accessing the locked records. To increase concurrency and avoid deadlocks, you should commit your changes frequently.

How Long Implicit Locks are Held

The DBMS maintains implicit exclusive locks until the transaction ends, which typically occurs when the next COMMIT, FINISH, or ROLLBACK statement is executed. Implicit share locks are maintained until the record is no longer current of run unit, set, area, or record. COMMIT ALL, FINISH, and ROLLBACK statements nullify all currencies and therefore cause all implicit shared locks to be released. COMMIT (without the ALL option) has no affect on currencies nor implicit share locks.

The following table lists the exclusive record locks set implicitly by each DML verb.

DML Verb

Records Locked

CONNECT/DISCONNECT

  • Connected/disconnected record
  • Next and prior of set being connected/disconnected
  • If set mode is INDEX, typically, one SR8 record

ERASE

  • Erased record
  • The record with the highest possible line number on thepage on which record resided
  • Next and prior of sets in which record is a member
  • If CALC, next and prior of CALC set
  • If owner of nonempty set occurrence, all member records
  • If variable-length record with stored fragments, all record fragments and the record with the highest possible line number on all pages on which fragments resided

FIND (as it applies to indexed records)

  • Typically, one SR8 record (released on returnfrom the FIND)

FIND (as it applies to logically deleted records encountered while walking a set in any update usage mode)

  • If disconnected from set being processed, DISCONNECT locks apply
  • If disconnected from last set occurrence, record is erased; ERASElocks apply

GET (as it applies to relocating variable-length records when fragments can be relocated while processing in any update usage mode)

  • The record with the highest possible line number on the record's homepage (the page on which the root of the record resides)
  • The record with the highest possible line number on all pages on which fragments formerly resided
  • All former fragments

MODIFY

  • Modified record
  • The record with the highest possible line number on thepage on which record resides (if record size changes)
  • If member of sorted set and if changing sort-key value, old and new next and prior in set occurrence
  • If CALC and modifying CALC key, old and new next and prior in CALC set
  • If modifying the symbolic key of an indexed set, two SR8 records
  • If variable-length record with stored fragments, all record fragments and the record with the highest possible line number on all pages on which fragments reside (if the fragment size changes or the fragment is added or deleted)

STORE

  • Stored record
  • The record with the highest possible line number on thepage on which record is being stored
  • Next and prior of all sets in which record is an automatic member
  • If CALC, next and prior of CALC set
  • If variable-length record with stored fragments, all record fragments and the record with the highest possible line number on all pages on which fragments are being stored
  • For indexed records, typically, one SR8 for each index in which the record participates

1 - Locks are set for next records only if the set has prior pointers.
2 - The record with the highest possible line number on a page is used to control updating of the available space on the page.