Open statement (LotusScript Language)

Opens a file, enabling access to it for reading or writing data.

Syntax

Open fileName

[ For { Random | Input | Output | Append | Binary } ]

[ Access { Read | Read Write | Write } ]

[{ Shared | Lock Read | Lock Read Write | Lock Write }]

As [#]fileNumber

[ Len = recLen ]

[Charset = MIMECharsetName]

This statement must appear on one line, unless you use an underscore ( _ ) for line continuation.

Elements

fileName

A string expression indicating the file to open. fileName may include a complete path. If you do not specify a drive and a directory, LotusScript® looks for the file in the default directory on the default drive. If you specify a drive but no directory, LotusScript looks for the file in the default directory of the specified drive. On platforms without drive letters, the default directory is used. If you specify a fileName that does not exist, LotusScript generates an error if the mode is Input; for all other modes, LotusScript creates the file and opens it.

For mode

Optional. Specifies the file's mode; the default is Random.

Access operations

Optional. Specifies what operations can be performed on the file. An error is generated if the access type conflicts with the file mode specified in the For clause.

Lock type

Optional. The default is Shared.Determines how the open file can be shared when accessed over a network by other processes, including processes owned by other users.

Under Windows 3.1, you must run SHARE.EXE to enable the locking feature if you are using MS-DOS version 3.1 or later. Lock is not supported for earlier versions of MS-DOS.

fileNumber

An integer expression with a value between 1 and 255, inclusive. This number is associated with the file when you open the file. Other file-manipulation commands use this number to refer to the file.

recLen

Optional. Designates the record length; use an integer expression with a value between 1 and 32767, inclusive.

For a Random file, recLen is the record length for the file (all records in a single file must have the same length). The default record length is 128 bytes.

For a sequential (Input, Output, or Append) file, recLen is the number of characters to be read from the file into an internal buffer, or assigned to an internal buffer before it is written to the file. This need not correspond to a record size, because the records in a sequential file can vary in size. A larger buffer uses more memory but provides faster file I/O. The default buffer size is 512 bytes.

For a Binary file, recLen is ignored.

MIMECharsetName

Note: This element is new with Domino® Release 6.

Optional. Designates the character set to use for sequential file I/O. If no character set is provided, file I/O is done in the platform code page with the following exceptions:

See MIME charset names for a list of valid MIME charset values.

Usage

If a file is already open in Binary, Random, or Input mode, you can open a copy of the file using a different file number, without closing the open file. If a file is already open in Append or Output mode, you must close it before opening it with a different file number.

LotusScript limits the number of open files to 255. Depending on your operating system environment and the IBM® software you are running, the actual number of files that you can open may be 15 or less. See your product documentation for details.

Example


Additional Documentation | Trademarks |