Multiple Record Locking

Multiple record locking permits many record locks to be held at once.

To specify multiple record locking, follow either the LOCK MODE IS MANUAL clause or the LOCK MODE IS AUTOMATIC clause with the WITH LOCK ON MULTIPLE RECORDS clause. For example:

 select fd-name
     assign to "muser.dat"
     lock mode is automatic with lock on multiple records
  • If you do not use the WITH LOCK ON MULTIPLE RECORDS clause, single record locking takes effect
  • If you specify multiple record locking for a file and you use the WRITELOCK Compiler directive when you compile your program, the program also acquires a record lock whenever it accesses the file with a WRITE or REWRITE statement