Microsoft KB Archive/10122
Record and File Locking Availability for COBOL 2.00
PSS ID Number: Q10122 Article last modified on 11-16-1992
Question: Does Microsoft COBOL Compiler Version 2.00 use buffers for its I/O? If so, how do I handle a case where a record that I wish to access is unlocked (i.e., not currently accessed), but still is in someone’s buffer? This problem occurs if the records being read or written are very small.
Response: COBOL Version 2.00 does not support record or file locking at run time under MS-DOS Version 2.x. Under MS-DOS Versions 3.10 and later, COBOL supports exclusive file locking for Sequential and Line Sequential files, and file and record locking for Relative files. For ISAM files, the initial release of COBOL Version 2.00 supports only exclusive file locking, not record locking; files opened for output or I/O are locked. COBOL keeps at least 512 bytes free in buffers. If no locking is employed and more than one person tries to update the file, problems can occur. Currently, there is no solution to this problem under MS-DOS Version 2.00. When file locking is used, only one person can update the file. Others must wait until the file is released. If record locking is available and is used, any record that is locked is unavailable to others. When the lock is released, it is written to disk and made available. In MS-DOS Version 3.10 environments, files are locked by default.
Copyright Microsoft Corporation 1992.