Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Locks

The locking of records is implemented differently in NK-ISAM (where key locks are used) and in K-ISAM (where block locks are used).

Key locks (NK-ISAM)

If a record is to be inserted into a file (STORE, INSRT) or a record with a specified key is to be deleted (ELIM), the record is locked by ISAM and unlocked again after processing. Even if the user has explicitly requested the record lock (external lock using LOCK), ISAM releases it after the write operation has been completed – except in the case of sequential write operations (PUT) via an I/O area. A range of keys is locked, the lower limit being a key less than or equal to the key of the records in the buffer. Its upper limit is “high value” (X'FF').

If a record is to be updated, the write operation is preceded by a read operation. The user must lock the record when he/she issues the read call (GET LOCK). The lock is released automatically when the record has been written back (PUTX) or deleted (ELIM with no key specified).

Read operations (GET, GETFL, GETKY, GETR) can be executed with or without a lock. Records which are not locked can be read and/or updated by other users. A lock requested for a read operation is not automatically reset by ISAM after the read operation. Even if a record is read with the aid of a secondary key, the lock applies to the primary key of the record.

For sequential reads with an I/O area, a key range is locked. The limits of this range are determined by the lowest and highest keys of the records currently in the I/O area.

Releasing locks

The user can explicitly clear a lock which exists in a file for his/her job (ISREQ). This may, for example, be necessary if he/she has locked a record for a read operation and this read operation is followed by no further ISAM actions for the file. Since each job may have only one lock active at any time, any ISAM operation which explicitly or implicitly requests a lock automatically clears any existing lock, thus avoiding the possibility of a deadlock situation.

Block lock (K-ISAM)

In K-ISAM, all locks are implemented in the form of block locks, i.e. the data block containing the record is locked for all other users.