OPEN OUTPUT Operation

The COBOL OPEN OUTPUT operation creates a file and opens it with an exclusive lock. This is performed in a single operating system call. With Btrieve, this operation requires two calls to the Btrieve run-time system, the first to create the file and the second to open the file with an exclusive lock. Because a small time lapse exists between these two calls, it is possible for a second user to access the file between the time that the file is created and the time that it is opened. If this happens, the second user finds the file empty and an attempt to read the file results in an "at end" error. The user performing the OPEN OUTPUT receives a "file locked" error because the exclusive OPEN call fails.