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

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

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>

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

Saved successfully!

Ooh no, something went wrong!