OSOPEN

Opens an OS file for processing.

 

COMMAND SYNTAX

OSOPEN expression {READONLY} {TO FileVar} {ON ERROR Statements} {THEN | ELSE} Statements {END}

 

SYNTAX ELEMENTS

expression Specifies the full file path.  If the file resides in the JEDIFILEPATH then just the file name is required.
READONLY Directs jBASE to open the file for reading only. If the program attempts to write to a file opened in READONLY mode, jBASE displays a runtime error message and does not update the file.
FileVar Specifies the variable to be used to hold the descriptor for the file. You will then be to able access the file using OSBREAD and OSBWRITE. If no file descriptor variable is supplied, then the file will be opened to the default file descriptor.
ON ERROR Statements Conditional jBC statements to execute if the OSOPEN statement fails with a fatal error because 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 OSOPEN statement fails it will execute any statements associated with an ELSE clause. If the OSOPEN is successful it will execute any statements associated with a THEN clause. Note that the syntax requires either one or both of the THEN and ELSE clauses.

 

NOTES

The jBC OSOPEN command opens a sequential file that does not use CHAR(10) as the line delimiter. Read/write access mode is the default.

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.

 

EXAMPLES

OSOPEN "c:\MyDirectory\MyFile" TO MYFILE ELSE STOP 201, "Can't find file"

 

RELATED COMMANDS

OSCLOSE, OSBREAD, OSBWRITE, OSREAD, OSWRITE, OSDELETE


jBC