WEOFSEQ Statement
Truncates a host file or Reality item that has been opened for sequential access. Host files can be truncated at the current position, but Reality items can only be truncated at the beginning or the end.
Syntax
WEOFSEQ seqfile-var {SETTING setting-var} {ON ERROR statement(s)}
Syntax Elements
seqfile-varis the name of a variable containing a sequential file reference (assigned via an OPENSEQ statement).
setting-varThe name of a variable to which the return status is assigned. See Operation for details of the possible values for this variable.
statement(s)A sequence of one or more valid DataBasic statements, either separated by semicolons, or contained on separate lines and followed by an END statement.
Operation
The following details circumstances under which the different clauses are executed and the values returned in setting-var:
Clause Executed |
Reason |
setting-var |
STATUS() Value |
---|---|---|---|
ON ERROR |
Not at start or end of Reality Item. |
2419 |
4 |
|
File or item opened, but not for sequential access (not opened with OPENSEQ) |
B45 |
12 |
|
File or item not open |
B12 |
12 |
|
General file error |
Error number |
Error number |
Example
OPENSEQ "/usr/pauls/qa4" TO SF1 THEN WEOFSEQ SF1 WRITEBLK DATA TO SF1 THEN NULL END CLOSESEQ SF1
This program opens the host file /usr/pauls/qa4 and saves a reference to the open file in variable SF1. The program then clears the file by truncating it at the beginning and writes the contents of the variable DATA to it. Finally, the file is closed.
See Also
SEEK statement, WRITESEQ statement, WRITEBLK statement, OPENSEQ statement, CLOSESEQ statement, READSEQ statement, READBLK statement, DELETESEQ statement.