The easiest way to enable your applications to use AcuServer is to update the FILE_PREFIX and CODE_PREFIX configuration variables in the runtime and server configuration files. Because these variables can be used to define multiple search directories, they are powerful tools for accessing both local and remote files. Sites that use FILE_PREFIX to specify multiple directories or multiple servers (either multiple server host machines or multiple instances of the acuserve program on a single host) may note a significant performance enhancement using name aliasing instead of FILE_PREFIX. See Using Name Aliases for more information.
To add a remote search path, you have two options:
You do not have to make any changes to the server configuration file. For example:
FILE_PREFIX . /usr/data @condor:/usr/data/ap @condor:/usr/data/ar CODE_PREFIX . /usr/objects @condor:/usr/objects/ap @condor:/usr/objects/ar
In this example, whenever the application attempts to access a data file, it will first look for the file in the current directory ("."), then in the local /usr/data directory, and finally on file server condor in the directory /usr/data/ap or /usr/data/ar.
To locate an object file, the application looks first in the current directory ("."), then in the local /usr/objects directory, and finally on the file server condor in the directory /usr/objects/ap or /usr/objects/ar.
For example, the runtime configuration file might contain:
FILE_PREFIX . /usr/data @condor: CODE_PREFIX . /usr/objects @condor:
The server configuration file would then include something like this:
FILE_PREFIX /usr/data/ap /usr/data/ar CODE_PREFIX /usr/objects/ap /usr/objects/ar
In this situation, a single network request can search multiple server directories for a file. (Setting multiple server directories on the client requires multiple network requests to search the directories.)
Note that you can change the PREFIX variables in the server configuration file after acuserve has started using the -config utility.
Note that if you want to specify the root directory on the server as a search path in the runtime configuration file, you must include a forward slash ("/") after the server name. To search the root directory on a server called condor, for example, you would specify @condor:/.
Although FILE_PREFIX and CODE_PREFIX are usually not applied to file names specified with absolute path names, you can force these variables to be used when the path name begins with a forward slash ("/"). To do this, set the APPLY_FILE_PATH or APPLY_CODE_PATH configuration variables (either locally or on the server) to on (1, true, yes). 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 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 4096 characters. The host operating system may, in addition, restrict environment variables to less than 4096 characters (refer to your operating system documentation).