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?



The WRITEBLK statement writes a block of data to a file opened for sequential processing. It takes the general form:

WRITEBLK expression ON file.variable {THEN statements [ELSE statements] | ELSE statements}


file.variable specifies a file opened for sequential processing.

The value of expression is written to the file, and the THEN statements are executed. 

If no THEN statements are specified, program execution continues with the next statement. If the file is neither accessible or does not exist, it executes the ELSE statements; and ignores any THEN statements.

If either expression or file.variable evaluates to null, the WRITEBLK statement fails and the program enters the debugger with a run-time error message.

Each WRITEBLK statement writes the value of expression starting at the current position in the file.

The current position is incremented to beyond the last byte written. WRITEBLK does not add a new line at the end of the data.


When using the WRITEBLK statement in International Mode, care must be taken to ensure that the write variable is handled properly before the WRITEBLK statement. The WRITEBLK statement expects the output variable to be in “bytes”, however when manipulating variables in International Mode character length rather than byte lengths are usually used and hence possible confusion or program malfunction can occur. 

If requiring byte count data the output variable can be converted from the UTF-8 byte sequence to ‘binary/latin1’ via the LATIN1 function.

It is not recommended that the READBLK/WRITEBLK statements be used when executing in International Mode. Similar functionality may be obtained via the READSEQ/WRITESEQ statement, which can be used to read/write, characters a line at a time from a file. 

Go back to jBASE BASIC.

Was this article helpful?