Welcome to jBASE's new documentation site! Many answers to your questions can be found by searching the Knowledgebase or viewing the jBASE Documentation. We also have a Google Group for peer discussion about jBASE. If you are unable to find the information you are looking for, jBASE Support will be glad to assist in resolving your technical problems. Enjoy and please provide comments and feedback .

How can we help you?

WRITESEQF

Descritpion

The WRITESEQF statement writes new lines to a file opened for sequential processing, and ensures that data is physically written to disk (that is, not buffered) before the next statement in the program is executed. The sequential file must be open, and the end-of-file marker must be reached before you can write to the file. The FILEINFO function can be used to determine the number of the line about to be written. 

It takes the general form:

WRITESEQF expression {ON | TO} file.variable [ON ERROR statements] 
{THEN statements [ELSE statements] | ELSE statements}

Where: 

file.variable specifies a file opened for sequential access. If expression or file.variable evaluates to the null value, the WRITESEQF statement fails and the program terminates with a run-time error message.

The value of expression is written to the file as the next line, and the THEN statements are executed. If THEN statements are not specified, program execution continues with the next statement; if the specified file cannot be accessed or does not exist, the ELSE statements are executed; any THEN statements are ignored.

The ON ERROR clause is optional in the WRITESEQF statement. Its syntax is the same as that of the ELSE clause. The ON ERROR clause lets you specify an alternative for program termination when a fatal error is encountered while the WRITESEQF statement is being processed.


Normally, when a record is written using the WRITESEQ statement, the record is moved to a buffer that is periodically written to disk. If a system failure occurs, this buffer data can be lost. The WRITESEQF statement forces the buffer contents to be written to disk; the program does not execute the statement following the WRITESEQF statement until the buffer is successfully written to disk.

A WRITESEQF statement following several WRITESEQ statements ensures that all buffered records are written to disk. WRITESEQF is intended for logging applications and should not be used for general programming. It increases the disk I/O of a program and therefore degrades performance.


Go back to jBASE BASIC

Was this article helpful?