When your COBOL application opens an existing file, most file systems linked into the runtime will be 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 runtime configuration file variables; the first is:
DEFAULT-HOST filesystem
This will designate the file system to be used for newly created files that are not individually assigned. For example,
DEFAULT-HOST ODBC
means that all new files will be ODBC files unless otherwise specified by the second configuration 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 configuration variable is used to assign an individual data file to a different file system. Any file so assigned will use the designated file system, and not the one specified by DEFAULT-HOST. For example,
myfile-HOST VISION
means that myfile will be under the Vision 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 runtime configuration file entries in combination to assign your new files in a default with exceptions manner; for example, this set of entries:
DEFAULT-HOST VISION
afile-HOST ODBC
bfile-HOST ODBC
means that all new files except afile and bfile will be assigned to Vision, and those two files will be assigned to ODBC.
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 runtime configuration file and is not changed in the COBOL program.
NOTE
The Acucorp interface for ODBC allows you to create an ODBC table with an OPEN OUTPUT statement, just as you can create Vision indexed files, if the data source driver allows for table creation. The ODBC equivalent of a Vision file is a table, not a database. You need to create a database for your ODBC tables before you run the COBOL program that creates the tables, just as you need to create a directory for your files before you run a COBOL program that creates Vision files.