basic.write
Writes dynamic array to file.
Syntax
write{x}{u} dynamic.array.variable on {file.variable,} id.expression
Description
writes the item from the dynamic array specified in 'dynamic.array.variable' into the specified file, using the item-id specified in the 'id.expression'.
If the file.variable is not specified, the default file.variable is used.
The 'writeu' statement writes a dynamic array into the specified file.variable and keeps the update lock set. 'writeu' additionally keeps items locked that were locked by a previous 'readu', 'readvu', or 'matreadu' statement.
The 'writex', 'matwritex' and 'matwritexu' statements all have the property of waiting until the actual disk update takes place before continuing execution of the program. They are used for 'critical' write-through, such as error-logging.
Example
write item on customer.file,item.id
This statement unconditionally writes the contents of the array.variable
'item' on the 'customer' file with a specified
'item.id'. If the item doesn't exist, it adds it. If the item
exists, it overwrites it.
readu item from customer.file,item.id else stop
...
begin case
case action = 'fs'
writeu item on customer.file,item.id
case action = 'fi'
write item on customer.file,item.id
return
case action = 'ex'
release customer.file,item.id
return
end case
...
Since a 'writeu' does not clear the item lock, a 'release'
or an explicit 'write' is required to clear the lock before
continuing.
See Also
User Comments
What do you think?
Share your experience or ask a question by using the form below.
Login to leave your comments.
