KEEPOPEN_LIST <file spec>
<file spec> can be a file name or a partial name including wildcard characters. See FairCom DB Standard Wildcards. Upon file creation or physical open, (1) if the file name matches a <file spec> and (2) if the file is a data file and (3) if the data file creation/open is part of an ISAM creation or open, then the KEEPOPEN attribute is attached to the data file and its indexes.
KEEPOPEN_LIST logic has internal checks to determine if the file open or create function returned an insufficient file control block error. If so, it checks if a KEEPOPEN file is available to close, closes it, and retries the open or create operation. The FairCom Server configuration option KEEPOPEN_CLOSE_RETRY_LIMIT determines the number of times these functions retry the operation before failing. It defaults to 3. The default value for KEEPOPEN_CLOSE_RETRY_LIMIT is appropriate for most situations. You may want to consider increasing it if you experience errors 165.
To specify multiple files, repeat the KEEPOPEN_LIST keyword for each file. You can specify KEEPOPEN_LIST as many times as you need. The only limitation is only one file per entry. For example:
KEEPOPEN_LIST custmast.dat
KEEPOPEN_LIST itemmast.dat
KEEPOPEN_LIST ordritem.dat
KEEPOPEN_LIST tell*.dat
Memory files have the option of staying open after all users have closed the file. The motivation for keeping memory files open is to avoid losing the contents of the file so that subsequent users can open the file and read and/or update the contents.
When a non-memory file is physically closed, c-tree removes the data cache and/or index buffer entries associated with the file. A file is physically closed when all users that have the file open close the file. For a non-memory file, keeping the file open even after all users have closed the file permits the associated cache/buffer entries to stay in memory. Then subsequent opens have the benefit of the cache contents.
ISAM data files and their associated indexes can also be designated as KEEPOPEN files. The motivation is to keep the files in the data cache and index buffers. It also eliminates a physical open when the next user opens the file. If all users have closed a KEEPOPEN file, then ctCLSNAM() can be called to close the data file and associated indexes.
Files to be treated in this manner are specified in the server configuration file with one or more entries of the form shown above.
Note: If a file is kept open by KEEPOPEN_LIST, a call to ctFILBLK does not block access to it. Calling CloseCtFileByName will close the file and it will remain closed until unblocked by a subsequent ctFILBLK call. (The FairCom DB Developer Guide explains the ctFILBLK and CloseCtFileByName functions.)
Behavior Change for V10.3.1 and Later
For a data or index file that does not use full transaction logging (ctTRNLOG), FairCom Server now flushes updated cache pages and sets the update flag to zero for the file when the last user closes the file and the KEEPOPEN_LIST option keeps the file open.
The configuration option KEEPOPEN_FLUSH NO can be used in ctsrvr.cfg to disable this flushing behavior and revert to the behavior prior to V10.3.1, although this is not recommended.
This is a change from previous behavior: When FairCom Server's KEEPOPEN_LIST configuration option was in effect for a c‑tree data or index file that was not under transaction control, FairCom Server kept that file open after the last user closed the file. Updated data and index cache pages remained and were not written to disk before the call to close the file returned to the caller. This caused unnecessary data integrity risk should the FairCom Server abnormally terminate while the file remained open. The file is likely to fail to open with an FCRP_ERR error, 14, under such scenarios.
See Also