Designating the Host File System

If you are opening an existing file, all file systems linked into the run time system are searched for the named file. If, however, you are creating a new file, you must tell the run time system which file system to use. You accomplish this with one of the following ACUCOBOL-GT runtime configuration file variables:

DEFAULT_HOST filesystem

or

filename_HOST filesystem

DEFAULT_HOST Variable

Use the DEFAULT_HOST variable to designate the file system to be used for newly created files that are not individually assigned. For example:

DEFAULT_HOST MSSQL

means that all new files are MSSQL tables unless otherwise specified by the second ACUCOBOL-GT runtime configuration file variable, filename_HOST.

filename_HOST Variable

Use the filename_HOST variable 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. The syntax is:

filename_HOST filesystem

where filename is the file name, without any extension, named in the ASSIGN TO clause of your SELECT statement. For example:

myfile_HOST MSSQL

means that myfile is under the MSSQL file system.

You can use these ACUCOBOL-GT runtime configuration file variables in combination to assign your new files in a default with exceptions manner; for example, this set of entries:

DEFAULT_HOST DB2
afile_HOST MSSQL
bfile_HOST MSSQL

means that all new files except afile and bfile are assigned to DB2, and those two files are assigned to MSSQL.

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 ACUCOBOL-GT runtime configuration file and is not changed in the COBOL program.

Note: The Acu4GL interface to MSSQL allows you to create an MSSQL table with an OPEN OUTPUT statement, just as you can create indexed files. The MSSQL equivalent of an indexed file is a table, not a database. You must create a database for your MSSQL tables before you run the COBOL program that creates the tables, just as you must create a directory for your files before you run a COBOL program that creates indexed files.

See To Install Acu4GL for Microsoft SQL Server for instructions to complete the installation. Once installation is complete, you can prepare and compile your COBOL program.