Description
Inserts or updates a row in the table. If the row does not exist, a new one will be created in the table. It the row does exist, it will be overwritten.
Syntax
Write expression on | to filevar, key then | else statements
Parameters
The Write statement has the following parameters.
Parameter | Description |
---|---|
Expression | Evaluates to the row that is to be written to the table. |
Filevar | Refers to a table variable that has been opened in a previous Open statement. |
Key | Specifies the key of the record to be written. |
Then | The statement(s) following Then are executed if the record is written successfully. |
Else | The statement(s) following Else are executed if the row cannot be written. The Status() function indicates the severity of the error, and the system variable @FILE_ERROR contains detail about the nature of the error. |
See also
Open, MatRead, MatWrite, Read, ReadV, WriteV
Example
/* The program reads row 100 in the CUSTOMER file and writes a value to column 5. */ @ID = 100 open "CUSTOMER" To FILE_CUSTOMER then read REC From FILE_CUSTOMER, @ID then REC<5> = "Stamford" Write REC On FILE_CUSTOMER, @ID else status = Set_FSError() end end end