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.

Note: You can use the ECL ON.ABORT command so that ABORT does not terminate<br />

the process. For information about the ECL ON.ABORT command, see the UniData<br />

<strong>Commands</strong> <strong>Reference</strong>.<br />

Examples<br />

In the following program segment, the user is prompted if an error flag ERR.FLAG<br />

has been set. The user’s input is read into the variable “answer”. If “answer” equals<br />

“Y”, the program aborts.<br />

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

ERR.FLAG = 1<br />

IF ERR.FLAG THEN<br />

PRINT "ABORT PROGRAM?"<br />

INPUT answer<br />

IF ANS = "Y" THEN ABORT<br />

...<br />

In the next example, in BASICTYPE P, an error message prints and the program<br />

terminates when CLIENTS cannot be opened:<br />

EID = "Error Message Text."<br />

ERR_MSG = "CAN'T OPEN FILE"<br />

OPEN "CLIENTS" TO CLIENTS.FILE ELSE<br />

ABORT ERR_MSG, EID<br />

END<br />

In the next example, in BASICTYPE P, the program segment prints the error message<br />

from record 10075 in the error message file if the program aborts:<br />

$BASICTYPE "P"<br />

OPEN 'CLIENTS' TO CLIENT.FILE ELSE STOP "CANNOT OPEN"<br />

READ REC FROM CLIENT.FILE, "99" ELSE ABORT 10075<br />

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

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

PRINTERR, STOP<br />

UniData<br />

ON.ABORT, CLEAR.ONABORT – For information, see the UniData <strong>Commands</strong><br />

<strong>Reference</strong>.

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

Saved successfully!

Ooh no, something went wrong!