File names referenced in an ASSIGN clause can be dynamically reassigned at runtime by configuration variables (this is sometimes referred to as name aliasing). Each file's ASSIGN name is searched for in the configuration environment and, if found, replaced by the value of the matching configuration variable. The exact meaning of this reassignment is detailed in File Name Interpretation.
For example, if your code contains a SELECT statement like:
INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT idx-file ASSIGN TO DISK "idx.dat" BINARY SEQUENTIAL STATUS IS idx-status.
you could define a name alias for idx.dat in your runtime configuration file by adding the line:
idx.dat usr2/data/idx.dat
Whenever your application references idx.dat in a SELECT statement, the alias /usr2/data/idx.dat is substituted.
Remote name notation is allowed in file aliases if your runtime is client-enabled.
Likewise, Internet notation is allowed if you are using AcuXML. For example, to read the XML file bookfile.xml over the Internet, you could map the file to its URL in your runtime configuration file:
BOOKFILE http://myserver.mycomp.com/data/bookfile.xml
Note that the XFD files required by AcuXML must still be available locally in the named XFD_DIRECTORY, but the data stream will be read from the server myserver.mycomp.com via HTTP.
For portability across applications, we recommend the following names for device files:
PRINTER | System spooler, default printer |
PRINTER1-9 | System spooler, printers 1-9 |
FORM | Default special-form printer |
FORM1-9 | Special-form printers 1-9 |
TAPE | Default tape/floppy transport |
TAPE1-9 | Tape/floppy transports 1-9 |
For example, a COBOL program might assign a print file to the system spooler, printer number 2, with the following line:
ASSIGN TO PRINT "PRINTER2"
Although the assignment of these names to physical devices is arbitrary, the following conventions are recommended:
No names are initially assigned. The process of assigning names is covered in File Name Interpretation.
For more selective aliasing, for example, changing the name of a single Vision segment, see the filename, filename_DATA_FMT, and filename_INDEX_FMT configuration variables described in Appendix H.