If you are opening an existing file, most, but not all, file systems linked into the run-time will be searched for the named file. If, however, you are creating a new file, you must tell the run-time which file system to use. You accomplish this 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 SYBASE
means that all new files will be Sybase 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 file system. Any file so assigned uses 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.
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 VISION afile_HOST SYBASE bfile_HOST SYBASE
means that all new files except afile and bfile will be assigned to Vision, and those two files will be assigned to Sybase.
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.
The interface to Sybase allows you to create a Sybase table with an OPEN OUTPUT statement, just as you can create Vision indexed files. The Sybase equivalent of a Vision file is a table, not a database. You need to create a database for your Sybase 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.
You are now ready to use the sql.acu program. You can find information on this program in Using the sql.acu Program.
After you learn about and use this utility, you will next find out about preparing and compiling your COBOL program, followed by learning to use the demonstration program. See Preparing and Compiling a Program Example and Demonstration Program for additional information.