


This variable has meaning only on graphical systems such as Windows. It gives you control over the Close action that appears on the System menu in a graphical environment. You may use the QUIT_MODE variable with only the main application window. All other windows return the CMD-CLOSE event when they are closed.
Many COBOL programs should not be shut down in an uncontrolled manner. This is especially true of any application that updates several files in a row. If the program is halted after updating the first file, but before updating the last, the files are left in an inconsistent state. For this reason, ACUCOBOL-GT allows you to control the Close action.
To do this, you set QUIT_MODE to a non-zero value. The value that you specify affects the Close action as follows:
| -2
| Disable Close: disables the Close action entirely. The Close menu item will
appear gray on the System menu, and the user will not be able to select it.
|
| -1
| Close only on input: the runtime disables the Close action except when it is
waiting for user input. This prevents the user from stopping the runtime in the
middle of a series of file operations, but still allows the user to quit the
application any time that the application is waiting for input.
|
| 0
| Always Close: the runtime halts the program whenever Close is selected from
the system menu.
|
| >0
| Program controlled Close: when a positive value is used, the Close item becomes a standard menu item with an ID equal to the value of QUIT_MODE. You may then handle the Close item just like any other menu item. |
MENU_ITEM Hot_Key ="shutdown" 100
In this example, the "shutdown" program might pop up a small window to confirm that the user wanted to exit and, if so, do a STOP RUN.
If you start your program in "safe" mode with the "-s" runtime option, then QUIT_MODE will be initialized to "-2" instead of "0". This prevents the user from using the Close menu item. A QUIT_MODE entry in the configuration file takes precedence over the default handling of "-s".
If a user attempts to end the Windows session when it is not allowed, a pop-up message box asks the user to terminate the application first. You can customize the message that appears in the box by setting the TEXT configuration variable, message number 18.