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?



Reads an OS file. It takes the general form: 

OSREAD Variable FROM expression {ON ERROR Statements} {THEN | ELSE} Statements {END}


  • Variable specifies the variable to contain the data from the read.
  • Expression specifies the full file path. If the file resides in the JEDIFILEPATH then just the file name is required.
  • ON ERROR statements conditional jBASE BASIC statements to execute if the OSREAD statement fails with a fatal error because the file is not open, an I/O error occurs, or jBASE cannot find the file. If you do not specify the ON ERROR clause and a fatal error occurs, the program terminates.

THEN | ELSE If the OSREAD statement fails it will execute any statements associated with an ELSE clause. If the OSREAD is successful, it will execute any statements associated with a THEN clause.


Syntax requires either one or both of the THEN and ELSE clauses.

OSREAD should not be used on large files. The jBASE BASIC OSREAD command reads an entire sequential file and assigns the contents of the file to a variable. If the file is too large for the program memory, the program aborts and generates a runtime error message. On large files, use OSBREAD or READSEQ.

jBASE uses the ASCII 0 character (CHAR (0)) as a string-end delimiter. ASCII 0 is not usable within string variable in jBASE BASIC. This command converts CHAR(0) to CHAR(128) when reading a block of data.

An example of use is as: 


to open a file located in the file-path. 

Go back to jBASE BASIC

Was this article helpful?