HP 3000 Manuals

Migrating Softkey Dependent Programs [ HP Business BASIC/XL Migration Guide ] MPE/iX 5.0 Documentation


HP Business BASIC/XL Migration Guide

Migrating Softkey Dependent Programs 

Softkeys work differently on the HP 3000 than they do on the HP 260.
This affects both general program flow and responses to any input
statements in HP Business BASIC/XL. The OPTION INPUTLOOPS command
simulates HP 260 softkey behavior to control input.

On the HP 260, softkeys can interrupt a program at any time, just as the
HALT key can.  Specifically, softkeys can interrupt a program when input
has been requested.  After processing softkeys, the HP 260 program
continues to wait for input.  Softkeys do not terminate input statements.

On the HP 3000, however, you can only use softkeys when input is
requested.  Softkeys can not be used for general program interrupts.
Softkeys terminate input statements in HP Business BASIC/XL. Any data
entered before you use a softkey will be lost.

Options 

You can migrate input statements in either of two ways:  with or without
loops.  Loops simulate BASIC/260 softkey behavior to control input.
Loops will be inserted in your program if you specify INPUT LOOPS in the
configuration file.  You can also specify this option as a migration aid
command.  The default is NO INPUT LOOPS. NO INPUT LOOPS changes all input
statements into HP Business BASIC/XL syntax.  No other changes are made;
no loops are inserted.

The following is a BASIC/260 program segment migrated with NO INPUT LOOPS
and INPUT LOOPS respectively:

BASIC/260 Segment:

     100 ON KEY #1,#2 GOTO Sfkey
     200 INPUT "Command: ";Com$

The program segment above changes to one of the following, depending on
the option you choose:

          Table 19-1.  Program Segment Migrated with NO INPUT LOOPS and INPUT LOOPS 

---------------------------------------------------------------------------------------------
|                                             |                                             |
|           NO INPUT LOOPS Segment            |            INPUT LOOPS Segment:             |
|                                             |                                             |
---------------------------------------------------------------------------------------------
|                                             |                                             |
| 1000 ON KEY 1,2 GOTO Sfkey                  | 1000 ON KEY 1,2 GOTO Sfkey                  |
|                                             |                                             |
---------------------------------------------------------------------------------------------
|                                             |                                             |
| 2000 INPUT "Command: ";Com$                 | 2000 LOOP                                   |
|                                             | 2001    INPUT "Command: ";Com$              |
|                                             | 2002    EXIT IF RESPONSE > 0                |
|                                             | 2003 ENDLOOP                                |
|                                             |                                             |
---------------------------------------------------------------------------------------------

The segment migrated with INPUT LOOPS remains in the loop and continues
requesting a command if you respond with either HALT or a softkey.  As
soon as you enter a command, the loop ends.  A timeout exits the loop,
too if you use TINPUT or ACCEPT with a timeout clause.

The migration aid changes the following statements as shown in the INPUT
LOOPS column above if you specify INPUT LOOPS:

 *  INPUT

 *  LINPUT

 *  TINPUT

 *  ACCEPT

The segment migrated with NO INPUT LOOPS changed to HP Business BASIC/XL
syntax.  No other changes were made.

Discovering How the Last Input Terminated 

HP Business BASIC/XL has a built-in function, called RESPONSE, that tells
you how the last input terminated.  RESPONSE is part of the loop inserted
by OPTION INPUT LOOPS to replace input statements.  RESPONSE was inserted
in the "INPUT LOOPS" program segment above.  The following statements
determine the value of the RESPONSE function:

INPUT                     Library routine BB_PUSH_KEY

LINPUT                    Program start

TINPUT                    Program stop

ACCEPT                    PRESS KEY

READ FORM                 FLUSH INPUT


NOTE Pressing a softkey also determines the value of the RESPONSE function.
The RESPONSE function returns the values shown in Table 19-2. Each value is followed by its definition. Table 19-2. How the Last Input Terminated --------------------------------------------------------------------------------------------- | | | | Response Function Value | Definition | | | | --------------------------------------------------------------------------------------------- | | | | -255 | HALT pressed | | | | --------------------------------------------------------------------------------------------- | | | | -n to -1 | Key n pressed | | | | --------------------------------------------------------------------------------------------- | | | | 0 | no input done or FLUSH INPUT executed | | | | --------------------------------------------------------------------------------------------- | | | | 1 | Hard HALT pressed | | | | --------------------------------------------------------------------------------------------- | | | | 2 | Timeout occurred | | | | --------------------------------------------------------------------------------------------- | | | | 10 | Input accepted | | | | --------------------------------------------------------------------------------------------- | | | | 11 | Input accepted without carriage return | | | | --------------------------------------------------------------------------------------------- Simulating the BASIC/260 WAIT Statement The WAIT statement provides an easy mechanism for using softkeys on the HP 260. However, on the HP 3000, you cannot use softkeys when a WAIT is active. In order to simulate HP 260 behavior in HP Business BASIC/XL, an infinite WAIT statement (a WAIT without a time limit) translates as follows: Table 19-3. Simulating the BASIC/260 WAIT Statement --------------------------------------------------------------------------------------------- | | | | BASIC/260 HP Business BASIC/XL | | | | | --------------------------------------------------------------------------------------------- | | | | 100 WAIT | 1000 LOOP | | | 1001 ACCEPT | | | 1002 EXIT IF RESPONSE=1 | | | 1003 ENDLOOP | | | | ---------------------------------------------------------------------------------------------


MPE/iX 5.0 Documentation