HP 3000 Manuals

ACCEPT [ HP Business BASIC/XL Reference Manual ] MPE/iX 5.0 Documentation


HP Business BASIC/XL Reference Manual

ACCEPT 

The ACCEPT statement obtains a string of characters from the designated
input device without echoing those characters to the display as they are
entered.  If a string variable is included in the ACCEPT statement, the
value of the string of characters is assigned to the string variable.
The characters in the entered string must be from the ASCII or default
foreign character set.  Otherwise, the terminal beeps.

No line feed is generated following statement execution, so the cursor
remains on the same line.

Syntax 

                 [                          [separator    ]]
ACCEPT [str_var] [[separator] option_clause [option_clause]]...

Parameters 

str_var             The string variable that the input string is assigned
                    to.  Characters are assigned to the variable when you
                    type RETURN. Characters, such as a comma or a double
                    quote, are not considered to be a data item separator
                    or terminator within the input string.  An ACCEPT
                    statement without a str_var discards the input.

option_clause       One of the following:

                    {TIMEOUT [=] timeout_num_expr}
                    {ELAPSED [=] elapsed_num_var }
                    {CHARS [=] chars_num_expr    }

timeout_num_ expr   Numeric expression for the maximum amount of time, in
                    seconds, allowed for you to enter input.  The input
                    time limit is determined as follows:

                    Value of            Input Time Limit
                    timeout_num_ expr 

                    Zero or less        Unlimited

                    In the range        That number of seconds rounded to
                    (0,255)             nearest second

                    Greater than 255    Set to 255 seconds

                    If input time is limited through the use of the
                    TIMEOUT option, HP Business BASIC/XL transfers
                    control to the next program statement when the time
                    limit is exceeded without assigning a new value to
                    the specified str_var.

elapsed_num_var     A numeric variable that the time, in seconds, used to
                    enter the input is returned to.  If the TIMEOUT
                    option is also specified, and that time limit is
                    exceeded, elapsed_num_var is set to -256.

                    If the ELAPSED option is not selected, the elapsed
                    time is not measured.

chars_num_expr      A numeric expression that evaluates to the maximum
                    number of characters that can be input.  Typing this
                    number of characters causes the generation of a
                    carriage return and assignment of the value to the
                    specified str_var.  Then the program begins execution
                    of the next statement in the program.

separator           One of the following:

                    {WITH}
                    {,   }
                    {;   }

Each option_clause can occur only once in an ACCEPT statement.

Examples 

The following examples show the use of the ACCEPT statement.  Lines 10 -
60 will assign the input string to a string variable, whole lines 70 -
110 discard the input.

     10  ACCEPT String_var1$
     20  ACCEPT String_var2$, TIMEOUT Time_limit
     30  ACCEPT String_var3$ WITH TIMEOUT=Time_limit
     40  ACCEPT String_var4$ WITH TIMEOUT Time_limit, ELAPSED Elapsed_time
     50  ACCEPT String_var5$, CHARS Num_chars, ELAPSED Elapsed_time
     60  ACCEPT String_var6$, ELAPSED Elapsed_time, CHARS 5, TIMEOUT 3
     70  ACCEPT
     80  ACCEPT TIMEOUT 5
     90  ACCEPT ELAPSED Elapsed_time
     100 ACCEPT CHARS 1
     110 ACCEPT TIMEOUT 1, CHARS 1



MPE/iX 5.0 Documentation