Example 1: Default Name Handling

Suppose you wanted to place data files in the \DATA subdirectory on a Windows system. You could then make the following assignment in the configuration file:

FILE_PREFIX    C:\DATA  D:\DATA

In this case, a file being created by an OPEN OUTPUT statement will be searched for first in the C:\DATA and D:\DATA directories. If it is found in either of these directories, that file will be removed and the new file placed in the same directory. If it is not found, however, then the new file will be created in the C:\DATA directory because that is the first one in the list.

Notice that the current directory is not mentioned in the above FILE_PREFIX configuration entry. This means that the current directory will not be searched for files. If you want the current directory to be one of the directories that is searched, add . to the FILE_PREFIX configuration entry. If a particular file must be located in the current directory, use the -F flag. The -F can be specified in the ASSIGN name. For example, if you want to ensure that file DIRLIST is located in the current directory regardless of the value of FILE_PREFIX, place the following clause in your source code:

ASSIGN TO "-F DIRLIST"

The -F flag ensures that DIRLIST is not further translated or modified. Note that the -F flag also ensures that the name is not translated when it is used in a configuration variable. Thus, another way to accomplish the same result, is with these two steps:

  1. Set the file name in the ASSIGN statement as:
    ASSIGN TO "DIRLIST"
  2. To cause the file to be placed in the current directory, place the following line in your configuration variable file, or set it in the environment:
    DIRLIST  -F DIRLIST
    Note: In the above case, the file is placed in the current directory regardless of the contents of FILE_PREFIX.

Normally, you should avoid using the full directory path names or the -F flag in your source code. If you can, use FILE_PREFIX in the configuration file. This will provide the most flexibility in file management for each individual site.