Previous Topic Next topic Print topic


File Locking

In versions prior to Visual COBOL 2.3, the semantics of the sharing phrase specified in an OPEN statement or used within a call to CBL_OPEN_FILE were not correctly applied in some cases on UNIX and Linux platforms. From version 2.3 onwards, the sharing phrase is correctly honored when the tunable strict_file_locking=true is set, which is the default setting.

Example of potential changes in behavior:

  • Process-A opens a file with read-only access and a sharing mode that denies other processes write access (SHARING WITH READ ONLY).
  • Process-B then attempts to open the file with read-only access and a sharing mode that denies other processes read access (SHARING WITH NO OTHER).

With strict_file_locking=true, Process-B is unable to open the file, because Process-A has successfully opened the file allowing only read access.

With strict_file_locking=false, Process-B successfully opens the file.

If your application encounters unexpected OPEN conditions or fails to open files, it might be as a result of the new file locking behavior. In such circumstances, we recommend that you review the file locking and sharing requirements of your application and refactor your source code to work with the default setting. The original file locking and sharing behavior can be restored by setting strict_file_locking=false.

Previous Topic Next topic Print topic