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?

WRITEU

Description

The WRITEU statement allows a program to write a record into a previously opened file. An existing record lock will be preserved. It takes the general form:

WRITEU variable1 ON|TO { variable2,} expression {SETTING setvar} 
{ON ERROR statements}

Where:

variable1 is the identifier holding the record to be written.

variable2, if specified, should be a jBASE BASIC variable that has previously been opened to a file using the OPEN statement. If variable2 is not specified then the default file is assumed.

The expression should evaluate to a valid record key for the file.

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

If the statement fails to write the record then any statements associated with the ON ERROR clause is executed.

The lock maintained by the WRITEU statement will be released by any of the following events:

  • the same program with WRITE, WRITEV or MATWRITE statements writes to the record.
  • the record lock is released explicitly using the RELEASE statement.
  • the program stops normally or abnormally.

An example of use is as: 

OPEN "Customers" ELSE ABORT 201, "Customers"
OPEN "DICT Customers" TO DCusts ELSE ABORT 201, "DICT Customers"

WRITEU Rec FROM DCusts, "Xref" Setting Err ON ERROR
    CRT "I/O Error[":Err:"]"
    ABORT
END


See also: READU, MATREADU, RELEASE

Go back to jBASE BASIC.

Was this article helpful?