WRITE


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

 

COMMAND SYNTAX

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

 

SYNTAX ELEMENTS

variable1 is the identifier containing the record to write.
variable2, if specified, should be a jBC 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 following values:

Incremental File Errors

128 No such file or directory
4096 Network error
24576 Permission denied
32768 Physical I/O error or unknown error

 

NOTES

If a lock was being held on the record by this process it will be released by the WRITE.

If you wish to retain a lock on a record you should do so explicitly with the WRITEU statement.

A 'WRITE' of a null item-id to a directory will take the 'ON ERROR' clause, if it exists. The absence of an 'ON ERROR' clause will display:

Error 2 during WRITE_ERROR to file 'directory_name'
Enter I to Ignore, R to Retry , Q to Quit :

 

EXAMPLES

OPEN "DICT Customers" TO DCusts ELSE
    ABORT 201, "DICT Customers"
END
WRITE Rec ON DCusts, "Xref" ON ERROR
    CRT "Xref not written to DICT Customers"
END


jBC