This configuration variable is designed for Windows 98 systems. It gives you some control over situations where a user must wait for access to a shared file. The runtime will try repeatedly to acquire the file lock, up to 400 times. If it has been unable to obtain a file lock after 400 tries, it will (by default) display a message box, asking if the user would like to continue waiting. If the user clicks the Yes button, then the runtime will try again another 400 times (or the value of LOCKING_RETRIES). If the user clicks the No button, then the runtime will return an error to the COBOL program (such as file error 30,33 (system error) or file error 99 (record locked).
The WAIT_FOR_FILE_ACCESS variable lets you choose one of three behaviors: either the user will always see the message box and make a choice, or the program will always return an error code if it cannot acquire the lock, or the runtime will always behave as if the user answered yes to the message box.
You can modify the text shown to the user in the message box via the TEXT configuration variable. The message is number 28. To include the filename in your message, insert %s at the place where you want the name of the file to appear. You can introduce line breaks by including "\n" in the message.
Possible values for the WAIT_FOR_FILE_ACCESS variable are:
0 | No | Do not display message box if lock is not acquired. Send error to COBOL program. |
1 | Ask | Show the message box and ask the user. (Default) |
2 | Yes | Do not show the message box. Assume that the user wants to wait for the file. This ensures that the user eventually can access the file, but introduces a small risk of an infinite loop if the system's lock table becomes corrupt. |
For programs running in background (-b runtime option), or programs with redirected input or output, the Ask option is treated the same as the Yes option.