UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software UniBasic Commands Reference - Rocket Software

rocketsoftware.com
from rocketsoftware.com More from this publisher
11.04.2013 Views

Parameter Description Example In the following example, the program segment writes the expression BAD.ACCOUNTS to the file ACCOUNTS. A message displays if the record pointer is not at the end of the file. 1-909 UniBasic Commands Reference ON ERROR statements Specifies statements to execute if the WRITESEQ statement fails with a fatal error because the file is not open, an I/O error occurs, or UniData cannot find the file. If you do not specify the ON ERROR clause and a fatal error occurs, the program terminates. THEN statements END THEN executes if the WRITESEQ is successful. END is required to terminate multiline THEN statements. ELSE statements END ELSE executes if the WRITESEQ is not successful or the record (or ID) does not exist. END is required to terminate multiline ELSE statements. WRITESEQ BAD.ACCOUNTS TO ACCOUNTS ELSE PRINT "NOT AT END-OF-FILE" Related Commands UniBasic WRITESEQ Parameters (continued) CLOSESEQ, OPENSEQ, OSBREAD, OSBWRITE, OSCLOSE, OSDELETE, OSOPEN, READSEQ, WEOFSEQ, WRITESEQF

WRITESEQF Syntax WRITESEQF expr [APPEND] {ON | TO} seq.file.var [ON ERROR statements] {THEN statements [END] | ELSE statements [END]} Description The UniBasic WRITESEQF command writes an expression as a record on a sequential file from a current record pointer position and forces UniData to immediately write the data to the disk. Note: Before you use WRITESEQF, you must open the file by using the OSOPEN or OPENSEQ command. Tip: Use the READSEQ command to position the record pointer before using WRITESEQF. If the file is a named pipe, you cannot use WRITESEQF to write to it. You must use the OSBWRITE command. Use the READSEQ command to position the record pointer before using WRITESEQF. Parameters The following table describes each parameter of the syntax. Parameter Description expr Specifies an expression to write as a record. APPEND Use the APPEND option to start the WRITESEQF process at the end-of-file mark. If you use the APPEND option in a file that does not contain data, UniData creates a new file. ON | TO seq.file.var Specifies a sequential file variable to receive the expression. WRITESEQF Parameters WRITESEQF 1-910

Parameter Description<br />

Example<br />

In the following example, the program segment writes the expression<br />

BAD.ACCOUNTS to the file ACCOUNTS. A message displays if the record pointer<br />

is not at the end of the file.<br />

1-909 <strong>UniBasic</strong> <strong>Commands</strong> <strong>Reference</strong><br />

ON ERROR statements Specifies statements to execute if the WRITESEQ statement<br />

fails with a fatal error because the file is not open, an I/O error<br />

occurs, or UniData cannot find the file.<br />

If you do not specify the ON ERROR clause and a fatal error<br />

occurs, the program terminates.<br />

THEN statements END THEN executes if the WRITESEQ is successful. END is<br />

required to terminate multiline THEN statements.<br />

ELSE statements END ELSE executes if the WRITESEQ is not successful or the<br />

record (or ID) does not exist. END is required to terminate<br />

multiline ELSE statements.<br />

WRITESEQ BAD.ACCOUNTS TO ACCOUNTS<br />

ELSE PRINT "NOT AT END-OF-FILE"<br />

Related <strong>Commands</strong><br />

<strong>UniBasic</strong><br />

WRITESEQ Parameters (continued)<br />

CLOSESEQ, OPENSEQ, OSBREAD, OSBWRITE, OSCLOSE, OSDELETE,<br />

OSOPEN, READSEQ, WEOFSEQ, WRITESEQF

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!