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 OSBREAD command reads data from a file starting at a specified byte location for a certain length of bytes, and assigns the data to a variable. It takes the general form: 

OSBREAD var FROM file.var [AT byte.expr] LENGTH length.expr [ON ERROR statements]


  • var specifies a variable to which to assign the data read,
  • FROM file.var specifies a file from which to read the data,
  • AT byte.expr specifies a location in the file from which to begin reading data. If byte.expr is 0, the read begins at the beginning of the file,
  • LENGTH length.expr specifies a length of data to read from the file, starting at byte.expr. length.expr cannot be longer than the maximum string length determined by system configuration,
  • ON ERROR statements specifies statements to execute if a fatal error occurs (if the file is not open, or if the file is a read-only file). If the ON ERROR clause is not specified, the program terminates under such fatal error conditions.


  • Before using OSBREAD, a file must be opened using the OSOPEN or OPENSEQ command. 
  • The ASCII 0 character [CHAR (0)] is used as a string-end delimiter. Therefore, ASCII 0 cannot be used in any string variable within jBASE. OSBREAD converts CHAR(0) to CHAR(128) when reading a block of data.
  • After execution of OSBREAD, the STATUS function returns either 0 or a failure code.
  • OSBREAD performs an operating system block read on a UNIX or Windows file.

An example of use is a program statement that reads 10,000 bytes of the file MYPIPE starting from the beginning of the file. The program assigns the data it reads to the variable Data.


Go back to jBASE BASIC


Was this article helpful?