


ACUCOBOL-GT employs a rich set of rules when translating a file name specified in an ASSIGN clause to an actual file name used on the host system. These rules provide a great deal of flexibility in placing files and dynamically reassigning them. These rules also allow for convenient handling of printers and other special devices. See section 2.8.2 for examples that illustrate many of the rules listed below.
When interpreting a file name, runcbl performs the following steps in order:
1. The initial name is taken from the ASSIGN clause of the file. If not specified in the ASSIGN clause, then the internal name specified by the SELECT clause is used instead.
2. If this name does not start with a hyphen, then it is searched for in the environment. First the runtime system's configuration variables are searched, followed by the host system's environment. The value of the variable found becomes the new name. This search is then repeated until either no new translation is found or the new name starts with a hyphen. Note that when the runtime system's configuration variables are initially loaded, any name found in both the runtime's configuration file and the user's environment is taken from the user's environment.
For example, if the name "PRINT-FILE" is assigned to "PRINTER1" in the ACUCOBOL-GT configuration file, and you have "PRINTER1" assigned to "/dev/lp" in the host's environment, then opening a file called "PRINT-FILE" will actually open the file "/dev/lp". "PRINT-FILE" is first translated to "PRINTER1" and then "PRINTER1" is subsequently translated to "/dev/lp".
3. If the name starts with a hyphen, it is interpreted in a special fashion described below. If it does not start with a hyphen, then it is considered to be a normal file name. This name is further processed as follows.
4. If the FILE-CASE configuration variable has been specified, the change to upper case or lower case is applied if appropriate.
5. The name is examined to see if it has an extension (zero to three characters following a period). If it does not, and the FILE-SUFFIX configuration variable has been defined, then the value of the FILE-SUFFIX is added to the name, with an intervening period if necessary.
6. The name isexamined to see if it is a full path name or contains a disk drive designation.
FILE-PREFIX is a configuration variable that contains one or more strings that are prefixed to the file name. After each string is prefixed, runcbl tries to find a file by that name. If it finds one, then processing of the name stops. If it does not, then the next prefix is tried until no more prefixes are available. A prefix consisting of a single period is treated as an empty prefix (i.e., the current directory is used).
7. If all the prefixes have been tried and the file has not been found, the first prefix is re-applied, and processing of the name stops. This means that files newly created by runcbl will reside, by default, in the first directory specified in the FILE-PREFIX configuration variable.
Upper or lower case in a file name is significant if it is significant to the host operating system. The same is true when the host environment is searched for a translation. Upper or lower case is not significant when runcbl's local environment is searched for a translation.
More: