Sequential File Access


OPENSEQ

Open file for sequential writing and or reading.

OPENSEQ Path{,File} {READONLY} TO FileVar { LOCKED statements } THEN | ELSE statements

Where:

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

 

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. 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.

 


CLOSESEQ

Close file previously opened for sequential access.

CLOSESEQ FileVar

Where:

FileVar contains the file descriptor of the previously opened sequential file

 


READSEQ

Read from file opened for sequential access.

READSEQ Variable FROM FileVar THEN | ELSE statements

Where:

Variable specifies the variable to contain next record from sequential file.
FileVar specifies the file descriptor of the file opened for sequential access.
Statements conditional jBC statements

NOTES

Each READSEQ reads a line of data from the sequentially opened file. After each READSEQ the file pointer moves forward to the next line of data. The variable contains the line of data less the new line character from the sequential file.

 


WRITESEQ

Write data to file opened for sequential access.

WRITESEQ Expression {APPEND} TO FileVar THEN | ELSE statements

or

WRITESEQF Expression {APPEND} TO FileVar THEN | ELSE statements

Where:

Expression specifies the variable to contain next record from sequential file.
FileVar specifies the file descriptor of the file opened for sequential access.
Statements conditional jBC statements

 

NOTES

Each WRITESEQ writes the data on a line of the sequentially opened file. Each data is suffixed with a new line character. After each WRITESEQ the file pointer moves forward to the end of line. The WRITESEQF statement forces each data line to be flushed to the file when it is written. The APPEND option forces each WRITESEQ to advance to the end of the file before writing the next data line.

 


WEOFSEQ

Write end of file on file opened for sequential access.

WEOFSEQ FileVar { THEN | ELSE Statements}

Where:

FileVar specifies the file descriptor of the file opened for sequential access.
Statements conditional jBC statements

 

NOTES

The WEOFSEQ forces the file to be truncated at the current file pointer.


Files