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

Parameters The following table describes each parameter of the syntax. Paramete r Description Note: In BASICTYPE M or P, if expr is nonnumeric or less than 1, UniData bypasses the GOTO clause and the next program statement executes. Example In the following example, the program statement transfers program control to the statement label TEST if the variable X is less than or equal to 1. If X is 2, UniData transfers control to statement label 2500. If X is greater than or equal to 3, UniData transfers control to statement label YESNO. ON X GOTO TEST,2500, YESNO Related Commands UniBasic GOSUB, GOTO, ON/GOSUB 1-533 UniBasic Commands Reference expr Specifies a numeric expression. UniData evaluates the expression, and then truncates it to an integer. Control passes to a statement label based on the following rules: If expr is less than or equal to 1, UniData transfers program control to the label starting at the first label in the list. If the number is 2, UniData transfers control to the label starting at the second label, and so forth. If expr is higher than the number of labels, UniData transfers control to the last label in the list. If expr is nonnumeric, control transfers to the first label. label Specifies a statement label or multiple statement labels. : Optional. A colon is required to identify a nonnumeric label in the statement label itself only, not in the reference to it in the ON/GOTO statement. ON/GOTO Parameters

OPEN Syntax OPEN ["expr",] "filename" [READONLY] [TO file.var] [ON ERROR statements] {THEN statements [END] | ELSE statements [END]} Description The UniBasic OPEN command opens a UniData hashed data or dictionary file, so you can read, write, or delete records from it. The number of files you can open is determined by operating system and UniData configuration parameters. For information about file performance, see Administering UniData on UNIX or Administering UniData on Windows Platforms. Warning: Do not use UniBasic READ commands to open or modify binary data in DIR-type files (for example, BP). Doing so could corrupt data in the file. Instead, use OSREAD or OSBREAD after executing the UniBasic NOCONVERT command. Parameters The following table describes each parameter of the syntax. Parameter Description expr Specifies the portion of file type to open: “” – UniData opens a data file. DICT – UniData open a dictionary file. filename Specifies the name of the file to open. READONLY Directs UniData to open the file for reading only. If the program attempts to write to a file opened in READONLY mode, UniData displays a runtime error message and does not update the file. For information about security procedures, see Administering UniData on UNIX or Administering UniData on Windows Platforms. OPEN Parameters OPEN 1-534

OPEN<br />

Syntax<br />

OPEN ["expr",] "filename" [READONLY] [TO file.var] [ON ERROR statements]<br />

{THEN statements [END] | ELSE statements [END]}<br />

Description<br />

The <strong>UniBasic</strong> OPEN command opens a UniData hashed data or dictionary file, so<br />

you can read, write, or delete records from it. The number of files you can open is<br />

determined by operating system and UniData configuration parameters. For information<br />

about file performance, see Administering UniData on UNIX or<br />

Administering UniData on Windows Platforms.<br />

Warning: Do not use <strong>UniBasic</strong> READ commands to open or modify binary data in<br />

DIR-type files (for example, BP). Doing so could corrupt data in the file. Instead, use<br />

OSREAD or OSBREAD after executing the <strong>UniBasic</strong> NOCONVERT command.<br />

Parameters<br />

The following table describes each parameter of the syntax.<br />

Parameter Description<br />

expr Specifies the portion of file type to open:<br />

“” – UniData opens a data file.<br />

DICT – UniData open a dictionary file.<br />

filename Specifies the name of the file to open.<br />

READONLY Directs UniData to open the file for reading only. If the program<br />

attempts to write to a file opened in READONLY mode, UniData<br />

displays a runtime error message and does not update the file. For<br />

information about security procedures, see Administering UniData on<br />

UNIX or Administering UniData on Windows Platforms.<br />

OPEN Parameters<br />

OPEN 1-534

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

Saved successfully!

Ooh no, something went wrong!