# WRITEV

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 WRITEV statement allows a program to write a specific field of a record in a previously opened file. It takes the general form:

WRITEV variable1 ON|TO {variable2,} expression1, expression2 {SETTING setvar} {ON ERROR statements}
1

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 it assumes the default file.

expression1 should evaluate to a valid record key for the file.

expression2 should evaluate to a positive integer number. If the number is greater than the number of fields in the record, it will add null fields to variable1. If expression2 evaluates to a non-numeric argument, it will generate a run time error.

If the SETTING clause is specified and the write fails, it sets setvar to one of these values.

The WRITEV statement will cause the release of any lock held on the record by this program. If you wish to retain a lock on the record, do so explicitly with the WRITEVU statement.

An example of use may be as:

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

WRITEV Rec ON DCusts, "Xref",7 Setting Err ON ERROR
    CRT "I/O Error[":Err:"]"
    ABORT
END
1
2
3
4
5
6
7

Go back to jBASE BASIC

Go back to Programmers' Reference Guide