Product Documentation

FairCom ISAM for C

Previous Topic

Next Topic


Record locking for BAT_UPD (as well as BAT_INS) is different from batch calls used to retrieve records. The retrieval batches use batch-specific protocols to manage the locks. BAT_UPD (and BAT_INS when records are added one at a time) use standard ISAM API calls to update the files; the locking behaves just as if the client made the ISAM API calls.

BAT_UPD includes support for these modifiers to affect record locking:

  • BAT_LOK_BLK: Acquire blocking lock when reading the record.
  • BAT_LOK_ONE: Release lock immediately after add/update.
  • BAT_LOK_KEEP: Keep locks after batch ends.
  • BAT_LOK_WRT: Acquire write lock when reading the record

If BAT_LOK_BLK and BAT_LOK_WRT are included with BAT_UPD, the ISAM lock state is changed to ctENABLE_BLK.

  • If either a transaction or LKISAM is called before BATSETX is invoked, the LKISAM state will be changed to ctENABLE_BLK only if the existing ISAM lock state is ctENABLE at the time BATSETX is invoked (typically this will be the case).

If BAT_LOK_BLK is included with BAT_UPD, this will cause the lock requests for the internal read operations (that find the existing versions of the records to be updated) to sleep if the record is locked by another user. This will cause the batch update to sleep until such locks are freed.

If BAT_LOK_KEEP is included with BAT_UPD, the data records updated or added to the file by BATSETX will remain locked on return from the BATSETX call. If either a transaction or LKISAM is called before BATSETX is invoked, the locks will remain after BATSETX returns whether or not BAT_LOK_KEEP is used. If neither was invoked before BATSETX, then BAT_LOK_KEEP will also cause the ISAM lock state set in BATSETX to persist after BATSETX returns.

If BAT_LOK_ONE is included with BAT_UPD and the file to be updated is not transaction controlled, then the record is unlocked after each record is updated or added; otherwise the records are unlocked at the end of BATSETX unless BAT_LOK_KEEP is in effect.

  • If the file is transaction controlled, BAT_LOK_ONE is ignored.