UniBasic Commands Reference - Rocket Software
UniBasic Commands Reference - Rocket Software UniBasic Commands Reference - Rocket Software
Warning: Processing differs when you include INPUT within a single-line IF/THEN/ELSE statement, which is illustrated by the following program segment: RESP = 5 IF RESP = 10 THEN INPUT TEST ELSE PRINT "NO INPUT" END This program produces no output because UniData interprets the ELSE as being a part of the INPUT statement, even though no WAITING clause is included. To avoid this, place the INPUT statement on its own line, as shown in the following example: RESP = 5 IF RESP = 10 THEN INPUT TEST END ELSE PRINT "NO INPUT" END Parameters The following table describes each parameter of the syntax. Parameter Description 1-383 UniBasic Commands Reference var Specifies a variable to receive the input. In the first form, if data (received by a DATA statement) is present in an input queue, INPUT assigns the next value to the variable var. If a DATA statement was not executed, INPUT prompts the user for input by displaying a question mark on the terminal. ,length Specifies the maximum number of characters accepted. _ UniData waits for the user to press ENTER before processing data input at the keyboard. If the underscore is not included, UniData stops accepting input when the user enters the maximum number of characters. Use the underscore parameter to allow the user to backspace after entering the maximum number of characters. For example, if you specify “INPUT X,5_”, the user can backspace to modify the entry after entering five characters. INPUT Parameters
Parameter Description : Normally, when a user types something and presses ENTER in response to an INPUT statement, UniData issues a line feed. The : parameter inhibits this line feed. ,-l UniData checks the type-ahead buffer. The following values are returned in var: 1 – Data is present in the buffer. 0 – No data is present in the type-ahead buffer. Use the -1 parameter to periodically check for input in an application that runs continuously. FOR | WAITING time.expr Examples In the following example, the program segment reads the first value established by the DATA statement and assigns it to the variable TEST. In this case, the value 10 is read. DATA 10,20,30,40,50 INPUT TEST Specifies the length of time to wait for input. If you do not enter the input before the wait period expires, var does not change, and the ELSE clause executes. If no ELSE nor THEN clause exists, the session terminates at the end of the wait period. UNFILTERED Sets INPUT to capture raw characters (such as backspace, up arrow, down arrow, or ENTER) from the keyboard. THEN statements ELSE statements Specifies statements to execute when input is received within the time specified in the FOR | WAITING clause and input is not an empty string. Specifies statements to execute if no input is received by the time specified in the FOR | WAITING clause or if the input is an empty string. INPUT Parameters (continued) In the next example, the program statement prints the prompt “Enter name:”. The INPUT statement then enables the user to enter any number of characters, stopping only when the user presses ENTER. The first 10 characters the user enters are assigned to the variable NAME. PRINT "Enter name: "; INPUT NAME,10_ INPUT 1-384
- Page 372 and 373: ICONV Syntax ICONV(expr,conv.code.e
- Page 374 and 375: STATUS Function Return Values After
- Page 376 and 377: 1-337 UniBasic Commands Reference
- Page 378 and 379: The following table describes vario
- Page 380 and 381: Related Command UniBasic OCONV Grou
- Page 382 and 383: Example In the following example, t
- Page 384 and 385: Parameters Description Example You
- Page 386 and 387: Parameter Description Examples In t
- Page 388 and 389: Parameter Description Example In th
- Page 390 and 391: ICONV Packed Decimal (MP1) Syntax I
- Page 392 and 393: Parameter Description Example In th
- Page 394 and 395: Example The following table describ
- Page 396 and 397: The following table lists conversio
- Page 398 and 399: ICONV Pattern Match (P) Syntax ICON
- Page 400 and 401: Example In the following example, t
- Page 402 and 403: ICONV Text Extraction (T) Syntax IC
- Page 404 and 405: ICONV File Translation (Tfile) Synt
- Page 406 and 407: STATUS Function Return Values After
- Page 408 and 409: 1-369 UniBasic Commands Reference
- Page 410 and 411: INDEX Syntax INDEX(str.expr1,str.ex
- Page 412 and 413: INDICES Syntax INDICES(file.var[, i
- Page 414 and 415: initSecureServerSocket function Syn
- Page 416 and 417: initServerSocket Syntax initServerS
- Page 418 and 419: INMAT Syntax INMAT( ) INMAT(array.n
- Page 420 and 421: Related Commands UniBasic DIM, MAT,
- Page 424 and 425: In the next example, the INPUT stat
- Page 426 and 427: Parameter Description 1-387 UniBasi
- Page 428 and 429: Related Commands UniBasic CLEARINPU
- Page 430 and 431: INPUTERR Syntax INPUTERR error.expr
- Page 432 and 433: INPUTIF Syntax INPUTIF var [THEN st
- Page 434 and 435: INPUTTRAP Syntax INPUTTRAP string.e
- Page 436 and 437: INS Syntax INS expr BEFORE dyn.arra
- Page 438 and 439: INSERT Syntax INSERT(dyn.array.expr
- Page 440 and 441: INT Syntax INT(num.expr) Descriptio
- Page 442 and 443: ISNV Syntax ISNV(expr) Description
- Page 444 and 445: ISNVS Syntax ISNVS(dynamic.array) D
- Page 446 and 447: ITYPE Syntax ITYPE(itype.expr) Desc
- Page 448 and 449: LE Syntax expr1 LE expr2 Synonyms #
- Page 450 and 451: LEN Syntax LEN(str.expr) Descriptio
- Page 452 and 453: LENS Syntax LENS(dyn.array) Descrip
- Page 454 and 455: LISTUSER Syntax LISTUSER() Descript
- Page 456 and 457: LN Syntax LN(num.expr) Description
- Page 458 and 459: The following table describes the s
- Page 460 and 461: Parameters The following table desc
- Page 462 and 463: LOCATE in BASICTYPEs U, P, and M Th
- Page 464 and 465: However, in the following array, th
- Page 466 and 467: Parameters The following table desc
- Page 468 and 469: LOOP/REPEAT Syntax LOOP [statements
- Page 470 and 471: Examples The following example is t
Parameter Description<br />
: Normally, when a user types something and presses ENTER in response<br />
to an INPUT statement, UniData issues a line feed. The : parameter<br />
inhibits this line feed.<br />
,-l UniData checks the type-ahead buffer. The following values are returned<br />
in var:<br />
1 – Data is present in the buffer.<br />
0 – No data is present in the type-ahead buffer.<br />
Use the -1 parameter to periodically check for input in an application that<br />
runs continuously.<br />
FOR |<br />
WAITING<br />
time.expr<br />
Examples<br />
In the following example, the program segment reads the first value established by<br />
the DATA statement and assigns it to the variable TEST. In this case, the value 10 is<br />
read.<br />
DATA 10,20,30,40,50<br />
INPUT TEST<br />
Specifies the length of time to wait for input. If you do not enter the input<br />
before the wait period expires, var does not change, and the ELSE clause<br />
executes. If no ELSE nor THEN clause exists, the session terminates at<br />
the end of the wait period.<br />
UNFILTERED Sets INPUT to capture raw characters (such as backspace, up arrow,<br />
down arrow, or ENTER) from the keyboard.<br />
THEN<br />
statements<br />
ELSE<br />
statements<br />
Specifies statements to execute when input is received within the time<br />
specified in the FOR | WAITING clause and input is not an empty string.<br />
Specifies statements to execute if no input is received by the time<br />
specified in the FOR | WAITING clause or if the input is an empty string.<br />
INPUT Parameters (continued)<br />
In the next example, the program statement prints the prompt “Enter name:”. The<br />
INPUT statement then enables the user to enter any number of characters, stopping<br />
only when the user presses ENTER. The first 10 characters the user enters are<br />
assigned to the variable NAME.<br />
PRINT "Enter name: "; INPUT NAME,10_<br />
INPUT 1-384