Updated: 10/19/2020, 10:24:56 AM
Created: 10/19/2020, 10:24:56 AM
Last Updated By: Daniel Klein
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