ContentsIndexPreviousNext

7.2.2 Using FILE_PREFIX and CODE_PREFIX

The easiest way to enable your applications to use AcuServer is to update the FILE_PREFIX and CODE_PREFIX runtime configuration variables to include paths with remote name notation. The ability of these variables to define multiple search paths makes them powerful tools for accessing both local and remote files.


Note: Sites that use the FILE_PREFIX variable to set up paths for multiple directories or multiple servers (either multiple server host machines or multiple instances of the acuserve program on a single host) can improve performance significantly by using name aliasing instead of FILE_PREFIX. For more information about name aliases, see section 7.2.4 Using Name Aliases.
Caution: When using FILE_PREFIX on Windows NT or Windows 2000 machines, it is best to use the full path to the directory. Avoid using Windows NT/2000 share names with FILE_PREFIX. Share names can seriously degrade file access performance because Windows NT and Windows 2000 are very slow to resolve them (a share name is the name assigned when a directory is set up for sharing via the Properties/Share/Share As dialog box).

To add a remote search path, simply append or insert the name and path of the remote directory to the variable's definition.

For example:

FILE_PREFIX  .  /usr/data  @condor:/usr/data
CODE_PREFIX  .  /usr/objects  @condor:/usr/objects

In the preceding examples, whenever the application attempts to access a file, it will first look for the file in the current directory ("."), then in the local "/usr/data" or "/usr/objects" directory, and finally on file server "condor" in the directory "/usr/data" or "/usr/objects."

You can force these variables to be used even when your files are specified with absolute path names. FILE_PREFIX and CODE_PREFIX are usually not applied to file names that have full paths (those beginning with a "/" or a device name, such as: "c:"). However, if you set the APPLY_FILE_PATH or APPLY_CODE_PATH runtime configuration variables to "on" ("1", "true", "yes"), they will be applied to file names that begin with a "/" (forward slash). For example, if your application specifies the file:

/usr/bernie/data/ind.dat

and FILE_PREFIX is set to:

FILE_PREFIX @condor:

and APPLY_FILE_PATH is on, the runtime will attempt to access the file at:

@condor:/usr/bernie/data/ind.dat

APPLY_FILE_PATH and APPLY_CODE_PATH affect only file names beginning with a "/" (forward slash), and do not affect file names beginning with a device name (such as "c:").

If the application attempts to access a file in a location (path) that does not exist, the program will terminate displaying an error similar to the following:

File error 35 on SEQ1.DAT

(This error also appears if the runtime is not AcuServer-enabled.)

Note that the maximum length of FILE_PREFIX and CODE_PREFIX is restricted by a number of factors. The ACUCOBOL-GT runtimes restrict runtime configuration variables to a maximum of 1023 characters. The host operating system may restrict environment variables to less than 1023 characters (refer to your operating system documentation).