ContentsIndexPreviousNext

9.1.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 9.1.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).