ProvideX V8.20 > Language Reference > 2. Directives
384
WRITE RECORD Directive
        Write Record
Format
WRITE RECORD (chan[,fileopt])contents$
Where:
chan
Channel or logical file number of the file to which to write.
contents$     String (literal, expression, or variable) that contains the contents of the
record to write.
Supported file options (see also, File Options, p.808):
fileopt
DOM=stmtref Missing record transfer
END=stmtref END-OF-FILE transfer
ERR=stmtref Error transfer
IND=num Record index
KEY=num Record key (see Automatic Padding below)
REC=name$ Record prefix (REC=VIS(string$) can also be used)
RTY=num Number of retries (one second intervals)
SIZ=num Number characters to write
TIM=num Maximum time-out value in integer seconds.
stmtref
Program line number or label to transfer control to.
Description
Use the WRITE RECORD directive to add / update a record for a file (logical file
number / channel). If the specific record already exists (indexed, direct, or sort files)
and you include the DOM=stmtref option, control transfers to the stmtref.
Otherwise, the specified record is updated.
In Keyed files with multiple keys, the WRITE RECORD directive automatically
updates all alternate keys. ProvideX supports use of the WRITE RECORD directive
with *MEMORY*.
Automatic Padding with KEY=Option
When you use KEY=string$:string$[:string$][...] ProvideX automatically pads key
segments. This is valid only if you have Keyed files with segmented key definitions.
ProvideX right-pads the key segment using $00$ (nulls) to the segment's full length.
The last segment in a compound key is not padded; e.g.,
Example:
KEYED "TEST", [1:1:5]+[2:1:6]+[3:1:8]
READ (1,KEY=A$:B$:C$)
is the same as
READ (1,KEY=PAD(A$,5,$00$)+PAD(B$,6,$00$)+C$)