The writev statement writes the value of an expression into the attribute designated in the attribute expression parameter, using the item-ID specified in ID.exp.
Syntax
writev exp ON {file.var ,} ID.exp, ac.exp |
Parameter(s)
exp |
Expression to write to the specified file. |
file.var |
File to write to. Contains the item expressed in ID.exp. If omitted, the default file variable is used. |
ID.exp |
Item to write to. Contains the attribute expressed in ac.exp. |
ac.exp |
Attribute to write to. |
Description
-1 can be used as the value of the attribute count expression. This appends a new attribute to the end of the item.
writev requires that the entire item be read into temporary workspace so that it can be rebuilt with the new attribute value, before it is written back to the file.
A series of writev statements addressing different attributes in the same item can get very slow because the item has to be reread for every writev.
A further problem with writev is that it is not atomic. A writev, although faster, is equivalent to this fragment of BASIC code:
xx<attr> = str write xx on file,item |
Example(s)
writev time() on control.file,’control.list’,3 |
See Also
Attribute Count Expression, begin work Statement, Default File Variables, File Variable, ID Expression, matread Statement, readv Statement, Statements and Functions, writevu Statement