Writes the values of a matrix into a record.Description

Syntax

MatWrite matrix On [filevar | Cursor cursorvar], key Then | Else statements

Parameters

The MatWrite statement has the following parameters.

ParameterDescription
matrixThe matrix must have been previously named and dimensioned by a Dimension statement. All the elements of the selected matrix are written as a single row in the designated table and in an ordered manner: the data of the first element in the matrix is assigned to the first column, the data of the second element is assigned to the second column, and so on.
cursorvarContains a cursor variable. Cursor variables are initialized with a Select...By statement and must be preceded with the key word Cursor. If the file being accessed has had control features added, cursor access will automatically use domain validation and conversion during a MatWrite.
filevarMust refer to a file variable name that has been previously named in an Open statement. If the specified file cannot be accessed, the program aborts with a runtime error message, and the elements of the matrix are left unchanged.
keyThe record referenced by key will be written to the file identified by table_var or the file accessed using the cursor in cursorvar.
ThenThe statement(s) following Then are executed if matrix is written successfully.
ElseThe statement(s) following Else are executed if the matrix 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.

Example

/* The matrix CUST is written to a file. Each array element becomes a column in the row. */
Dim CUST(30)
For CTR = 1 To 30
       CUST(CTR) = CTR
Next CTR
MatWrite CUST On cust_table, CUST_NO Else
       status = Set_FSError()
End
  • No labels