Record Locking with Shared Direct Access Files

Record Locking with Shared Direct Access Files

Hi, How do I implement record locking on a fixed length direct access file that is shared between separate processes? The database is a simple stream/binary file located on a central server. The first several bytes have been reserved for use as a record status flag. Each process will open the file with "share=denynone" and will read the record lock status flag and will not perform any write operations and only limited read operations if the indicated record is presently open for writing by another process. Since each application will be executing on a remote host and the file itself will reside on a central server, I would guess that there will be timing issues that need to be handled. Can I implement a simple wait and re-read (or re-read before write) to ensure that the current process has control of that particular record? How else can I implement this? No, SQL is NOT an option.

Thanks

1 post / 0 new
For more complete information about compiler optimizations, see our Optimization Notice.