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?

OPENPATH

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

Where: 

  • 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: 

OPENPATH "C:\Home\CUSTOMERS" TO F.Customers ELSE ABORT 201, "CUSTOMERS"

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

OPEN "F:\Users\data\CUSTOMERS" ELSE ABORT 201, "CUSTOMERS"

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


See also: OPEN statement.

Go back to jBASE BASIC.

Was this article helpful?