Updated: 11/30/2021, 7:00:45 PM
Created: 11/30/2021, 7:00:45 PM
Last Updated By: Jake Tuttle
Read Time: 1 minute(s)

Tags: file handling

# Description

The OSOPEN command opens a sequential file that does not use CHAR(10) as the line delimiter. The command takes the general form:

OSOPEN filename TO file.var [ON ERROR statements] {THEN | ELSE} statements [END]


  • filename specifies the file to open. filename must include the complete path name unless the file resides in the current directory,
  • TO file.var Specifies a variable to contain a pointer to the file,
  • ON ERROR statements specifies statements to execute if the OSOPEN 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 enters the debugger.

THEN statements Execute if the read is successful.

ELSE statements Execute if the read is not successful or the record (or ID) does not exist.

# Note

Read/write access mode is the default. Omitting READONLY and WRITEONLY will by default specify this access mode.

After opening a sequential file with OSOPEN, use OSBREAD to read a block of data from the file, or OSBWRITE to write a block of data to the file. You also can use READSEQ to read a record from the file, or WRITESEQ or WRITESEQF to write a record to the file, if the file is not a named pipe. (READSEQ, WRITESEQ, WRITESEQF are line-oriented commands that use CHAR (10) as the line delimiter.)

An example of use would be a program statement that opens the file ‘MYSLIPPERS’ as SLIPPERS.


Go back tojBASE BASIC.

Go back to Programmers' Reference Guide