# STATUS Function

Updated: 10/14/2021, 2:20:00 PM
Created: 10/14/2021, 2:20:00 PM
Last Updated By: mikes
Read Time: 2 minute(s)

# Usage

If used after an OPENPATH statement, the STATUS function will find the cause of a file open failure (that is, for a statement in which the ELSE clause is used). The following values can be returned if the statement is unsuccessful:

For the file access commands, READ, WRITE, OPEN, the function returns:

  • 0 if successful, or an
  • Operating System error code if previous command failed.
  • 13 is returned if permission denied on UNIX systems.

For OCONV conversions, the function returns:

  • 0 if conversion was successful,
  • 1 if an invalid conversion is requested,
  • 3 if conversion of possible invalid date.

If used after CLOSE, DELETE, MATREAD, MATWRITE, OPEN, READ or WRITE, STATUS returns 0 if successful and no error occurs. In the event an error occurs, status returns the error number.

If used after an OPEN, OPENPATH, or OPENSEQ statement, the file type is returned if the file is opened successfully. If the file is not opened successfully, the following values may be returned:

If used after a READ statement, the STATUS function returns, if the file is a distributed file, the following:

If used after a READL, READU, READVL, or READVU statement, if the statement includes the LOCKED clause, the returned value is the terminal number, as returned by the WHO command, of the user who set the lock.

If used after a READSEQ statement, the STATUS function will return 1 if at end-of-file.

If used after a READT, REWIND, WEOF, or WRITET statement, the returned value is hardware-dependent (I.e. varies according to the characteristics of the specific tape drive unit).
The documentation that accompanied drive unit for may offer information about interpreting the values returned by the STATUS function.

Go back to jBASE BASIC

Go back to Programmers' Reference Guide