When your COBOL application opens an existing file, most file systems linked into the run time system are searched for the named file. However, each time the COBOL application creates a new file, it needs to know which file system to use. You provide the name of the file system with one of two run time configuration file variables. The first is:
DEFAULT_HOST filesystem
This designates the file system to be used for newly created files that are not individually assigned. For example,
DEFAULT_HOST DB2
means that all new files are DB2 files unless otherwise specified by the second ACUFH configuration file variable, which is:
filename_HOST filesystem
where filename is the file name, without any extension, named in the ASSIGN TO clause of your SELECT statement. This variable is used to assign an individual data file to a different file system. Any file so assigned uses the designated file system, and not the one specified by DEFAULT_HOST. For example,
myfile_HOST MFDATA
means that myfile is under the file system, and:
myfile_HOST DB2
means that myfile is under the DB2 file system. The ability to designate a different file system for certain files enables you to tailor your application to a specific customer's needs or to implement an incremental conversion for a customer. With relational databases, this is particularly useful in that it allows you to tune an application for processing speed and resource requirements.
You can use these run time configuration file variables in combination to assign your new files in a default with exceptions manner; for example, this set of entries:
DEFAULT_HOST MFDATA
afile_HOST DB2
bfile_HOST DB2
means that all new files except afile and bfile are assigned to data, and those two files are assigned to DB2.
You can also change the values of these variables during program execution by including in your code:
SET ENVIRONMENT "filename_HOST" TO filesystem
or
SET ENVIRONMENT "DEFAULT_HOST" TO filesystem
This enables you to change file systems during the execution of your program. This is not the typical way to specify a file system; normally it is designated in the run time configuration file and is not changed in the COBOL program.