contents.gifindex.gifprev1.gifnext1.gif

Informix: Switching File Systems

Each time a file is opened, the file system identified by the filename-HOST configuration variable (if present) or the DEFAULT-HOST variable is used. You can change the value of these variables in your code by including:

SET ENVIRONMENT "filename-HOST" TO filesystem
or
SET ENVIRONMENT
"DEFAULT-HOST" TO filesystem

just before you open the file. SET ENVIRONMENT thus enables you to change file systems during the execution of your program. The filesystem value for Informix is INFORMIX. The value for Vision is VISION.

If you change to the Informix file system in the midst of a program, be sure to specify the database to be used:

SET ENVIRONMENT "DEFAULT-HOST" TO "INFORMIX"

SET ENVIRONMENT "DATABASE" TO "STORES"

Note that the database cannot be changed if there are tables open in the active database. Be sure to close all tables before making a change.

Remember that SET ENVIRONMENT is not the typical way to specify a file system. Normally the file system is designated in the runtime configuration file and is not changed in the COBOL program.