OPENSEQ


Opens a file for sequential writing and/or reading.

 

COMMAND SYNTAX

OPENSEQ Path{,File} {READONLY} TO FileVar {SETTING setvar} {ON ERROR statements} { LOCKED statements } THEN | ELSE statements

 

SYNTAX ELEMENTS

Path specifies the relative or absolute path of the target directory or file
File specifies additional path information of the target file
FileVar contains the file descriptor of the file when the open was successful
Statements conditional jBC statements

 

If the SETTING clause is specified and the read fails, setvar will be set to one of the following values:

Incremental File Errors

128 No such file or directory
4096 Network error
24576 Permission denied
32768 Physical I/O error or unknown error

If ON ERROR is specified, the statements following the ON ERROR clause will be executed for any of the above Incremental File Errors except error 128.

 

NOTES

If the file does not exist or cannot be opened then the ELSE clause is executed. However if JBCEMULATE is set for Sequoia (use value "seq") emulation then OPENSEQ will create the file if it does not exist. This behavior can also be achieved by specifying "openseq_creates = true" in Config_EMULATE for the emulation being used. Alternatively, the CREATE statement can be used, which eliminates the need for the 'openseq_creates = true' Config_EMULATE option.

Once open a lock is taken on the file. If the lock cannot be taken then the LOCKED clause is executed if it exists otherwise the ELSE clause is executed. If READONLY is specified then the process takes a read lock on the file otherwise a write lock is taken. The specified file can be a regular, pipe or special device file. Locks are only taken on regular file types. Once open the file pointer is set to the first line of sequential data.

Sequential Files can be further manipulated with these Sequential File Extensions.

 

EXAMPLES

 


jBC