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

Tags: record handling file handling

# Description

The OPENPATH statement opens a file (given an absolute or relative path) to a descriptor variable within jBASE BASIC.

OPENPATH expression1 TO {variable} {SETTING setvar} THEN|ELSE statements


  • expression1 should be an absolute or relative path to the file including the name of the file to be opened,
  • If specified, variable will be used to hold the descriptor for the file. It should then be to access the file using READ and WRITE. If no file descriptor variable is supplied, then the file will be opened to the default file descriptor,
  • If the OPENPATH statement fails it will execute any statements associated with an ELSE clause. If successful, the OPENPATH will execute any statements associated with a THEN clause. The syntax requires either one or both of the THEN and ELSE clauses.

If the SETTING clause is specified and the open fails, setvar will be set to one of these values.

# Note

The path specified may be either a relative or an absolute path and must include the name of the jBASE file being opened.

The file that is the subject of the OPENPATH statement can be of any type known to the jBASE system. Its type will be determined and correctly opened transparently to the application, which need not be aware of the file type.

A jBASE BASIC program can open an unlimited amount of files.

An example of use is as:


to open the file CUSTOMERS (located in C:\Home) to its own file descriptor F.Customers, or:


to open the CUSTOMERS file (located in F:\Users\data) to the default file variable.

See also: OPEN statement.

Go back to jBASE BASIC

Go back to Programmers' Reference Guide