WRITEBLK

Top  Previous  Next

 

The WRITEBLK statement writes data at the current file position in a record previously opened using OPENSEQ.

 

 

Format

 

WRITEBLK var TO file.var

{ON ERROR statement(s)}

{THEN statement(s)}

{ELSE statement(s)}

 

where

 

varis the name of a variable holding the data to be written.

 

file.varis the file variable associated with the file.

 

statement(s)are statements to be executed depending on the outcome of the WRITEBLK operation.

 

At least one of the THEN and ELSE clauses must be present.

 

The THEN clause is executed if the WRITEBLK is successful.

 

The ELSE clause is executed if the WRITBLK fails. The  STATUS() function will indicate the cause of the error.

 

The ON ERROR clause is executed for serious fault conditions such as errors in a file's internal control structures. The STATUS() function will return an error number. If no ON ERROR clause is present, an abort would occur.

 

 

Example

 

WRITEBLK VAR TO SEQ.F ELSE STOP 'Write error'

 

This program fragment writes data to a file previously opened to file variable SEQ.F.

 

 

See also:

CLOSESEQ, NOBUF, OPENSEQ, READBLK, READCSV, READSEQ, WRITECSV, WEOFSEQ, WRITESEQ, WRITESEQF