An external file is a text file other than the primary data file that you can use in a data entry or batch application. You can read and/or write to external files, using CSPro logic. You must create a data dictionary that describes the format of any external file you want to use. An external file dictionary can contain only one level.
You can share external files across a network. If an external file is accessed only by read functions (loadcase, locate, find, key, retrieve), no special programming actions need to be taken to share the file. Multiple users can read the file at any time.
However, if an external file is accessed by any write functions (writecase or delcase) only one user at a time may use the file. For write functions, the external file is like a file in a filing cabinet. When one person has taken out the file for use, no one else can use the file until the person has returned it.
You can control when the file is in use by coding open and close functions. The file is in use between the execution of the open and the close function. This gives you complete control over when the file is in use. You should try to minimize the time the file is in use in order to allow other users to access the file.
If open and close functions are not coded for an external file used for writing, the following "open" and "close" rules apply:
• In batch processing, the file is opened at the beginning of the run and closed at the end.
• In data entry processing, the file is opened just before any external file function is executed and is closed immediately following the function, unless one of the following functions is used on the file:
- loadcase without a var-list
- retrieve
- key
When any of the above functions is used, the file is opened just before the first file function is executed, but is left open after the function is completed. These functions depend on remembering the current position of the file. If the file is closed, the current position is lost.
See also: Insert or Drop a File from an Application, Lookup Files