Skip to main content
Previous sectionNext section

FileMode

Allow writing to a non-existent file.

Synopsis

[Miscellaneous]    FileMode=n

n is either 1 (true) or 0 (false). The default value is 0.

Description

When FileMode is enabled (n = 1), if a file that does not exist is opened for reading or writing, a new file is created. When this parameter is not enabled, a new file is not created (unless specified in the OPEN command parameters).

Suppose InterSystems IRIS® data platform encounters an OPEN command such as:

OPEN "file.x":"WS"

When FileMode=1 the new file is created automatically, even though the “N” parameter is not specified with the OPEN command. The result when FileMode=1 is equivalent to adding the N parameter to each OPEN command, so that the above OPEN command is equivalent to:

OPEN "file.x":"WNS"

On the other hand, when InterSystems IRIS encounters an OPEN command and no N parameter is provided and the file does not already exist, then if FileMode=0 there is no result from the OPEN command except that the process hangs until interrupted.

Changing This Parameter

On the Compatibility page of the Management Portal (System Administration > Configuration > Additional Settings > Compatibility), in the FileMode row, click Edit. Select FileMode to enable this setting.

Instead of using the Management Portal, you can change FileMode in the Config.Miscellanous class (as described in the class reference) or by editing the CPF in a text editor (as described in the Editing the Active CPF section of the “Introduction to the Configuration Parameter File” chapter in this book).

To change this parameter for a single process only (as opposed to instance-wide), use the FileMode() method of the %SYSTEM.Process class. See the class reference for details.