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

CAUTION:
When using FILE_PREFIX on Windows NT, Windows 2000 to 2008 machines, it is best to use the full path to the directory, rather than using share names (a share name is the name assigned when a directory is set up for sharing using the Properties/Share/Share As dialog). Share names can seriously degrade file access performance because Windows NT and Windows 2000/2003/2008 are very slow to resolve them.

To add a remote search path, you have two options:

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