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

# Description

The WRITE statement allows a program to write a record into a previously opened file.

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


  • variable1 is the identifier containing the record to write,
  • variable2, if specified, should be a previous opened variable to a file using the OPEN statement. If variable2 is unspecified, the default file variable is assumed.
  • the expression should evaluate to a valid record key for the file.
  • If specifying the SETTING clause and the write fails, it sets setvar to one of the these values.

If holding a lock on the record by this process, it is released by the WRITE. If it is desired to retain a lock on a record, it should be stated explicitly with the WRITEU statement.

An example of use would be as:

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

WRITE Rec ON DCusts, "Xref" ON ERROR
    CRT "Xref not written to DICT Customers"

Go back tojBASE BASIC.

Go back to Programmers' Reference Guide