UniBasic Commands Reference - Rocket Software
UniBasic Commands Reference - Rocket Software UniBasic Commands Reference - Rocket Software
GET Syntax GET[X] var[,length] [SETTING count.var] FROM line.expr [UNTIL term.expr] [RETURNING term.var] [WAITING seconds] [THEN statements |ELSE statements] Description The UniBasic GET command receives unprompted input from an attached line. UniData accepts all control characters, including the carriage return and line feed as input characters. All data read from the attached line is placed in var. GET supports multibyte languages. Performance of the GET statement varies according to the termination conditions specified, and whether the THEN or ELSE clauses are specified. Input from the attached line is terminated in four ways: UniData has read the number of characters specified in length. After a single character is read (when length and UNTIL are not coded). When any character you specify in term.exp is encountered in input. When UniData reads the record mark character, @RM, and the number of seconds has elapsed. Note: UniData never executes the ELSE clause if you include UNTIL without WAITING or length. If you code the WAITING clause, UniData executes the ELSE clause only after the number of seconds specified for timeout. If the input is terminated for any other reason, UniData executes the THEN clause. In special cases, UniData executes the ELSE clause if the line has not been attached before executing the GET statement. 1-288 UniBasic Commands Reference
Parameters The following table describes each parameter of the syntax. Parameter Description X Specifies that GET return var as hexadecimal. This feature allows binary data to contain a 255 value (hexadecimal FF). For instance, if a user enters HELLO, the input data variable contains 48454C4C4F. var Specifies a variable to receive input. ,length Specifies the number of characters to accept as input from the attached line. The default is one character unless you use UNTIL in the statement. SETTING count.var count.var is the number of characters received from the attached line. FROM line.expr line.expr is the attached line receiving input. UNTIL term.expr term.expr is a string of characters, any of which terminate input. The terminating character does not appear in the returned text variable. If you use UNTIL and do not specify term.expr, any number of characters is accepted. Characters often used for the UNTIL clause are carriage return and line feed. RETURNING term.var Assigns the character that terminates the input to term.var. Input terminates due to: Reaching the maximum number of characters. Timeout. Record mark encountered in input. In this case, term.var contains an empty string. WAITING seconds Specifies the number of seconds to wait before UniData times out. THEN statements | ELSE statements If the line is not attached, UniData performs the ELSE clause. If the line is not attached and there is not an ELSE clause, a runtime error displays and the user enters the UniBasic debugger. GET Parameters 1-289
- Page 276 and 277: Related Commands UniBasic COMMON, E
- Page 278 and 279: Parameter Description Examples In t
- Page 280 and 281: The program output is: 1-274 UniBas
- Page 282 and 283: EXP Syntax EXP(expr) Description Th
- Page 284 and 285: Examples The following program segm
- Page 286 and 287: In the next example, the program se
- Page 288 and 289: Options The value of option determi
- Page 290 and 291: FILEINFO Syntax FILEINFO(file.var,
- Page 292 and 293: Code 9 Merge factor percentage 10 S
- Page 294 and 295: FILELOCK Syntax FILELOCK [file.var]
- Page 296 and 297: FILEUNLOCK Syntax FILEUNLOCK [file.
- Page 298 and 299: FIND Syntax FIND expr IN dyn.array[
- Page 300 and 301: Related Commands UniBasic [], FINDS
- Page 302 and 303: Parameter Description Examples In t
- Page 304 and 305: FMT Syntax FMT(expr, "len [f.char]
- Page 306 and 307: STATUS Function Return Values After
- Page 308 and 309: FOOTING Syntax FOOTING [ON num.expr
- Page 310 and 311: Related Commands UniBasic GETPTR, H
- Page 312 and 313: This program segment produces the f
- Page 314 and 315: Parameter Description Examples The
- Page 316 and 317: FUNCTION Syntax FUNCTION function.n
- Page 318 and 319: The following program calls the pre
- Page 320 and 321: GE Syntax expr1 GE expr2 Synonyms #
- Page 322 and 323: generateKey Syntax generateKey(priv
- Page 324 and 325: Return Code Status 1-286 UniBasic C
- Page 328 and 329: Example In the following example, t
- Page 330 and 331: Parameters The following table desc
- Page 332 and 333: getHTTPDefault Syntax getHTTPDefaul
- Page 334 and 335: GETLIST Syntax GETLIST list.name [,
- Page 336 and 337: UniData SQL SELECT - For informatio
- Page 338 and 339: STATUS Function Return Values After
- Page 340 and 341: GETQUEUE Syntax GETQUEUE() Descript
- Page 342 and 343: GETREADU Syntax GETREADU() Descript
- Page 344 and 345: getResponseHeader Syntax getRespons
- Page 346 and 347: The following table describes each
- Page 348 and 349: Parameters The following table desc
- Page 350 and 351: GETUSERGROUP Syntax GETUSERGROUP(ui
- Page 352 and 353: GETUSERNAME Syntax GETUSERNAME(uid)
- Page 354 and 355: 1-316 UniBasic Commands Reference
- Page 356 and 357: Related Commands UniBasic GOSUB, ON
- Page 358 and 359: Examples In the following example,
- Page 360 and 361: Parameter Description The replace.n
- Page 362 and 363: This next example compiles and runs
- Page 364 and 365: Related Command UniBasic GTS 1-326
- Page 366 and 367: HASH Syntax HASH(rec.key,modulo,typ
- Page 368 and 369: Parameters The following table desc
- Page 370 and 371: HUSH Syntax HUSH {ON | OFF | expr}
- Page 372 and 373: ICONV Syntax ICONV(expr,conv.code.e
- Page 374 and 375: STATUS Function Return Values After
GET<br />
Syntax<br />
GET[X] var[,length] [SETTING count.var] FROM line.expr [UNTIL term.expr]<br />
[RETURNING term.var] [WAITING seconds]<br />
[THEN statements |ELSE statements]<br />
Description<br />
The <strong>UniBasic</strong> GET command receives unprompted input from an attached line.<br />
UniData accepts all control characters, including the carriage return and line feed as<br />
input characters. All data read from the attached line is placed in var. GET supports<br />
multibyte languages.<br />
Performance of the GET statement varies according to the termination conditions<br />
specified, and whether the THEN or ELSE clauses are specified.<br />
Input from the attached line is terminated in four ways:<br />
UniData has read the number of characters specified in length.<br />
After a single character is read (when length and UNTIL are not coded).<br />
When any character you specify in term.exp is encountered in input.<br />
When UniData reads the record mark character, @RM, and the number of<br />
seconds has elapsed.<br />
Note: UniData never executes the ELSE clause if you include UNTIL without<br />
WAITING or length.<br />
If you code the WAITING clause, UniData executes the ELSE clause only after the<br />
number of seconds specified for timeout. If the input is terminated for any other<br />
reason, UniData executes the THEN clause.<br />
In special cases, UniData executes the ELSE clause if the line has not been attached<br />
before executing the GET statement.<br />
1-288 <strong>UniBasic</strong> <strong>Commands</strong> <strong>Reference</strong>