11.04.2013 Views

UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Parameter Description<br />

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

TO file.var Specifies a file variable in which to place a pointer to the opened file.<br />

If you do not specify file.var, the file you open becomes the default file.<br />

UniData performs all default file operations on this file. (Default file<br />

statements include all types of read, write, or delete when no file<br />

variable specified).<br />

A single default file can be declared in each <strong>UniBasic</strong> program or<br />

subroutine, and the default file is specific to the program or subroutine<br />

in which it is defined. If a main program opens a default file, and then<br />

calls an display subroutine that also opens a default file, UniData<br />

restores the original default file when returning to the main program.<br />

ON ERROR<br />

statements<br />

THEN statements<br />

END<br />

ELSE statements<br />

END<br />

The ON ERROR clause enables the program to continue to perform<br />

when a fatal error occurs such as when the file is not open, an I/O error<br />

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

If a VOC entry exists for a file that does not exist, the ON ERROR<br />

clause executes. However, if no VOC entry exists, the ELSE statement<br />

executes.<br />

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

the program terminates.<br />

THEN executes if the open is successful. END is required to terminate<br />

multiline THEN statements.<br />

ELSE executes if the OPEN is not successful or the record does not<br />

exist.<br />

If the file exists, but some other error occurs, the ELSE statement<br />

executes. However, if a file does not exist and no VOC entry exists, the<br />

ELSE statement executes.<br />

END is required to terminate multiline ELSE statements.<br />

OPEN Parameters (continued)

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

Saved successfully!

Ooh no, something went wrong!