RAD - RUNLIGHT

RAD

Supported On UX WS DOS IN
Option Required None
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

RAD selects radians as the unit of measure for angles.

Example Statements

RAD

Syntax

Semantics

All functions which return an angle will return an angle in radians. All operations with parameters representing angles will interpret the angle in radians. If no angle mode is specified in a program, the default is radians (also see DEG).

A subprogram "inherits" the angle mode of the calling context. If the angle mode is changed in a subprogram, the mode of the calling context is restored when execution returns to the calling context.

RANDOMIZE

Supported On UX WS DOS IN
Option Required None
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

RANDOMIZE selects a seed for the RND function. For a specific seed value used with RANDOMIZE, each computer platform that runs HP BASIC may produce a different result.

Example Statements

RANDOMIZE
RANDOMIZE Old_seed*PI

Syntax

Item Description Range
seed numeric expression, rounded to an integer; Default = pseudo-random 1 through 231-2

Semantics

The seed actually used by the random number generator depends on the absolute value of the seed specified in the RANDOMIZE statement.

Absolute Value\of Seed Value Used
less than 1 1
1 through 231-2 INT(ABS(seed))
greater than 231-2 231-2

The seed is reset to 37 480 660 by power-up, SCRATCH A, SCRATCH, and program prerun.

RANK

Supported On UX WS DOS IN
Option Required MAT
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

RANK returns the number of dimensions in an array. The number is an INTEGER.

Example Statements

Dimensions=RANK(Array$)
IF RANK(A)=2 THEN PRINT "A is a matrix"

Syntax

Item Description Range
array name name of an array any valid name

RATIO

Supported On UX WS DOS
Option Required GRAPH
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

RATIO returns the ratio of the X hard-clip limits to the Y hard-clip limits for the current PLOTTER IS device.

Example Statements

WINDOW 0,10*RATIO,-10,10
X_gdu_max=100*MAX(1,RATIO)
Y_gdu_max=100*MAX(1,1/RATIO)

Syntax

READ

Supported On UX WS DOS IN
Option Required None
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

READ reads values from DATA statements and assigns them to variables.

Example Statements

READ Number,String$
READ Array(*)
READ Field$[5,15]
READ Item(1,1),Item(2,1),Item(3,1)

Syntax

Item Description Range
numeric name name of a numeric variable any valid name
string name name of a string variable any valid name
subscript numeric expression, rounded to an integer -32 767 through +32 767 (see array in Glossary)
beginning position numeric expression, rounded to an integer 1 through 32 767 (see substring in Glossary)
ending position numeric expression, rounded to an integer 0 through 32 767 (see substring in Glossary)
substring length numeric expression, rounded to an integer 0 through 32 767 (see substring in Glossary)

Semantics

The numeric items stored in DATA statements are considered strings by the computer, and if they are READ into a numeric variable, they are first processed by a number builder to convert them to numbers. The number builder for READ recognizes the usual combinations of signs, digits, decimal points, and signed exponents. If the characters are not a valid representation of a number, an error results. If a number in a DATA statement contains a fractional part and is read into an INTEGER variable, it will be rounded up or down (not truncated) appropriately. When a READ statement contains a COMPLEX variable, that variable is satisfied with two REAL values. A string variable may read numeric items, as long as it is dimensioned large enough to contain the characters.

The first READ statement in a context accesses the first item in the first DATA statement in the context unless RESTORE has been used to specify a different DATA statement as the starting point. Successive READ operations access following items, progressing through DATA statements as necessary. Trying to READ past the end of the last DATA statement results in error 36. The order of accessing DATA statements may be altered by using the RESTORE statement.

An entire array can be specified by replacing the subscript list with an asterisk. The array entries are made in row major order (right most subscript varies most rapidly).

READIO

Supported On UX* WS DOS*
Option Required None
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

READIO reads the contents of the specified hardware register on the specified interface.

Upper_byte=READIO(Gpio,4)
PRINT "Register";I;"=";READIO(7,I)

Syntax

Item Description Range
select code numeric expression, rounded to an integer 1 through 31, and -31 through -1; +9826; 9827
register number or memory address numeric expression, rounded to an integer hardware-dependent

NOTE
Unexpected results may occur with select codes 9826 and 9827.

Semantics

Positive select codes do a byte read (appropriate for most device registers); negative select codes do a word read.

Reading Memory ("Peek")

Select code 9826 is used to read a byte of memory, while -9826 is used to read a word (16 bits) of memory. The second parameter specified in the READIO function is the memory address of the byte to be read. This parameter is interpreted as a decimal address; for instance, an address of 100 000 is 10^5, not 2^20.

Determining the Location of Numeric Variables

Select code 9827 is used to determine the memory address of a HP BASIC variable. You can use this address, for instance, with WRITEIO to perform a JSR ("Jump to SubRoutine") instruction in machine language, execute the instructions contained in the array, and then return to HP BASIC. (See WRITEIO for details.)

HP BASIC/UX Specifics

You are restricted to memory access within your own process space.

For HP BASIC/UX 700, only pseudo-select codes 9826 and 9827 are supported.

HP BASIC/DOS Specifics

Use of READIO or WRITEIO requires specific knowledge of the measurement coprocessor hardware. In general, it is recommended that you use STATUS and CONTROL instead.

READ KEY

Supported On WS
Option Required KBD
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

READ KEY reads typing-aid softkey definitions into a string variable.

Example Statements

READ KEY 2,A$
READ KEY This_key,String$
READ KEY Key,Key_array$(*)

Syntax

Item Description Range
key number numeric expression, rounded to an integer 0 to 23

Semantics

When the string variable is not an array, the single softkey definition specified by the key number is read. When the string variable is an array, all the typing-aid softkey definitions beginning with the key number specified are read into the array.

The exact size required for the READ KEY string variable depends on the the number of characters in the softkey definition of interest. The largest typing-aid softkey definition allowed contains 256 bytes of character data per softkey.

For more information on typing-aid softkeys, refer to HP BASIC/WS 6.2 or Using HP BASIC/UX, and the "Communicating with the Operator" chapter of HP BASIC Programming Guide.

Related Commands

SET KEY, EDIT KEY, LOAD KEY

READ LABEL

Supported On UX* WS DOS*
Option Required MS
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

READ LABEL reads a volume label into a string variable.

Example Statements

READ LABEL Volume_name$
READ LABEL Vol_name$ FROM Volume$

Syntax

Item Description Range
string variable string variable which returns the volume name --
volume specifier string expression; Default = the default mass storage unit (see MASS STORAGE IS)

Semantics

A LIF or HFS volume label consists of a maximum of 6 characters. SRM volumes can have labels up to 16 characters.

HP BASIC/UX Specifics

READ LABEL does not work for HFS in HP BASIC/UX.

HP BASIC/DOS Specifics

READ LABEL is not supported for DFS.

READ LOCATOR

Supported On UX WS DOS
Option Required GRAPHX
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

READ LOCATOR samples the locator device without waiting for a digitize operation.

Example Statements

READ LOCATOR X_pos,Y_pos
READ LOCATOR X,Y,Status$
READ LOCATOR X,Y,Status$[3]

Syntax

Item Description Range
x coordinate name name of a numeric variable any valid name
y coordinate name name of a numeric variable any valid name
string name name of a string variable or substring any valid name

Semantics

Executing this statement issues a request to the current locator device to return a set of coordinates. The coordinates are sampled immediately, without waiting for a digitizing action on the part of the user. GRAPHICS INPUT IS is used to establish the current locator device. The returned coordinates are in the unit-of-measure currently defined for the PLOTTER IS and GRAPHICS INPUT IS devices. The unit-of-measure may be default units or those defined by either the WINDOW or SHOW statement. If an INTEGER numeric variable is specified, and the value returned is out of range, Error 20 is reported.

The optional string variable is used to input the device status of the GRAPHICS INPUT IS device. This status string contains eight bytes, defined as follows.

Byte 1: Button status; This value represents the status of the digitizing button on the locator. A "0" means the button is not depressed, and a "1" means the button is depressed. This is an unprocessed value, and a "1" does not necessarily represent successful digitization. If the numeric value represented by this byte is used as the pen control value for a PLOT statement, continuous digitizing will be copied to the display device.
Bytes 2, 4, and 6: commas; used as delimiters.
Byte 3: Significance of digitized point; "0" indicates that the point is outside the P1, P2 limits; "1" indicates that the point is outside the viewport, but inside the P1, P2 limits; "2" indicates that the point is inside the current viewport limits.
Byte 5: Tracking status; "0" indicates off, "1" indicates on.
Bytes 7 and 8: The number of the buttons which are currently down. To interpret the ASCII number returned, change the number to its binary form and look at each bit. If the bit is "1", the corresponding button is down. If the bit is "0", the corresponding button is not down. If the locator device (e.g., stylus or puck) goes out of proximity, a "button 7" is indicated in the "button number" bytes. The number will be exactly "64", regardless of whether any actual buttons are being held down at the time. The HP 9111A always returns "00" in bytes 7 and 8.

REAL

Supported On UX WS DOS IN*
Option Required None
Keyboard Executable No
Programmable Yes
In an IF ... THEN ... No

REAL reserves storage for floating point variables and arrays. (For information about the REAL function, see the next entry in the keyword dictionary; for information about using REAL as a secondary keyword, see the ALLOCATE, COM, DEF FN, or SUB statements.)

Example Statements

REAL X,Y,Z
REAL Array(-128:127,15)
REAL Buf(100) BUFFER ! HP BASIC/UX/WS/DOS only 

Syntax

Item Description Range
numeric name name of a numeric variable any valid name
lower bound integer constant; Default = OPTION BASE value (0 or 1) -32 767 through +32 767 (see array in Glossary)
upper bound integer constant -32 767 through +32 767 (see array in Glossary)

Semantics

Each REAL variable or array element requires eight bytes of number storage. The maximum number of subscripts in an array is six, and no dimension may have more than 32 767 elements.

The total number of REAL variables is limited by the fact that the maximum memory usage for all variables--numeric and string--within any context is 16 777 215, bytes (or limited by the amount of available memory, whichever is less).

Declaring Buffers

To declare REAL variables to be buffers, each variable's name must be followed by the keyword BUFFER; the designation BUFFER applies only to the variable which it follows.

REAL (function)

Supported On UX WS DOS
Option Required COMPLEX
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

REAL returns the real part of a COMPLEX number.

Example Statements

X=REAL(Complex_expr)
Y=REAL(Real_expr)
Z=REAL(Integer_expr)
Result=REAL(CMPLX(2.1,-8))

Syntax

Item Description/Default Range\Restrictions
argument numeric expression any valid INTEGER, REAL, or COMPLEX value

Semantics

An INTEGER or REAL argument is returned unchanged.

RECORDS

See TRANSFER.

RECOVER

RECOVER causes control to return to the specified line when an event occurs. Multiple contexts may be skipped coming back to the specified line. This keyword works with all ON event interrupts. Refer to the appropriate keyword dictionary ON event entry for more information.

RECTANGLE

Supported On UX WS DOS
Option Required GRAPHX
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

RECTANGLE draws a rectangle. It can be filled, edged, or both.

Example Statements

RECTANGLE Width,Height
RECTANGLE 4,-6,FILL,EDGE

Syntax

Item Description Range
width numeric expression --
height numeric expression --

Semantics

The rectangle is drawn with dimensions specified as displacements from the current pen position. Thus, both the width and the height may be negative.

Which corner of the rectangle is at the pen position at the end of the statement depends upon the signs of the parameters:

Sign\of X Sign\of Y Corner of Rectangle\at Pen Position

+

+

Lower left

+

-

Upper left

-

+

Lower right

-

-

Upper right

Shape of Rectangle

A rectangle's shape is affected by the current viewing transformation. If isotropic units are in effect, the rectangle will be the expected shape, but if anisotropic units (set by WINDOW) are in effect, the rectangle will be distorted; it will be stretched or compressed along the axes.

If a rotation transformation and anisotropic units (set by WINDOW) are in effect, the rectangle is rotated first, then stretched or compressed along the unrotated axes.

FILL and EDGE

FILL causes the rectangle to be filled with the current fill color, and EDGE causes the perimeter to be drawn with the current pen color and line type. If both FILL and EDGE are specified, the interior will be filled, then the edge will be drawn. If neither FILL nor EDGE is specified, EDGE is assumed. Unexpected results can occur in attempts to FILL a rectangle of zero area.

Rectangles sent to an HPGL plotter are edged but not filled regardless of any FILL or EDGE directives on the statement.

Applicable Graphics Transformations
Scaling PIVOT CSIZE LDIR PDIR
Lines (generated by moves and draws) X X [4]
Polygons and rectangles X X X
Characters (generated by LABEL) X X
Axes (generated by AXES & GRID) X
Location of Labels [1] [3] [2]

[1] The starting point for labels drawn after lines or axes is affected by scaling.

[2] The starting point for labels drawn after other labels is affected by LDIR.

[3] The starting point for labels drawn after lines or axes is affected by PIVOT.

[4] RPLOT and IPLOT are affected by PDIR.

REDIM

Supported On UX WS DOS
Option Required MAT
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

REDIM changes the subscript range of previously dimensioned arrays.

Example Statements

REDIM Array(New_lower:New_upper)
REDIM String$(A,B,C)

Syntax

Item Description Range
array name name of a string or numeric array any valid name
lower bound numeric expression, rounded to an integer; Default = OPTION BASE value (0 or 1) -32 768 through +32 767 (see array in glossary)
upper bound numeric expression, rounded to an integer -32 768 through +32 767 (see array in glossary)

Semantics

The following rules must be followed when redimensioning an array:

REDIM does not change any values in the array, although their locations will probably be different. The REDIM is performed left-to-right and if an error occurs, arrays to the left of the array the error occurs in will be redimensioned while those to the right will not be. If an array appears more than once in the REDIM, the right-most dimensions will be in effect after the REDIM.

RELEASE

Supported On UX (HP BASIC/UX 700 only)
Option Required None
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

RELEASE causes the media in a magneto-optical drive to be released, so it can be removed.

Example Statements

RELEASE ":LIF,1402"
RELEASE ":,1404,0,1"

Syntax

Item Description Range
volume specifier string expression (see drawing)
device type literal (see Semantics)
device selector integer constant (see Glossary)
unit number integer constant; Default = 0 0 through 255 (device dependent)
volume number integer constant; Default = 0 (device dependent)

Semantics

RELEASE is needed for LIF (":LIF") volumes on magneto-optical devices on HP BASIC/UX 700 only. For HFS volumes (":HFS"), the normal HP-UX mount and unmount commands control device access.

The HP-UX system on Series 700 computers uses the scsi hard disk driver to access the magneto-optical disk in drives such as the HP C1701A Model 650A rather than the scsifloppy driver. As a result, the drive does not notify HP BASIC/UX of media changes. Instead, it locks the media into the drive when you first open the device. Once locked, the media cannot be removed until the device is closed (at HP BASIC/UX QUIT time). RELEASE notifies HP BASIC/UX 700 to close the device so the media can be removed. On the next access attempt, HP BASIC/UX automatically reopens the device, which locks the media again.

It is possible that some other process has opened the device, such as a C program, or another copy of HP BASIC/UX. In that case, RELEASE cannot close the device. One solution is to quit the other process(es). If another copy of HP BASIC/UX has opened the device, use the RELEASE command in that copy.

RELEASE also works on SCSI floppy disks. When a running copy of HP BASIC/UX accesses a floppy disk, its related device file is opened. This prevents another copy of HP BASIC/UX on the same computer from accessing the same disk to execute a command such as INITIALIZE. To allow access, and avoid using SCRATCH A or having to QUIT your HP BASIC/UX, use RELEASE in the copy of HP BASIC/UX that opened the device file. Once RELEASE closes the device file, another copy of HP BASIC/UX can access the disk.

REM

Supported On UX WS DOS IN
Option Required None
Keyboard Executable No
Programmable Yes
In an IF ... THEN ... No

REM specifies that the remainder of a program line is a comment, not a program statement or label.

Example Statements


100 REM  Program Title
190 !
200 Info=0  ! Clear flag byte

Syntax

Item Description Range
literal string constant composed of characters from the keyboard, including those generated with the ANY CHAR key --

Semantics

REM must be the first keyword on a program line. If you want to add comments to a statement, an exclamation point must be used to mark the beginning of the comment. If the first character in a program line is an exclamation point, the line is treated like a REM statement and is not checked for syntax.

REMOTE

Supported On UX WS DOS IN
Option Required IO
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

REMOTE places HP-IB devices having remote/local capabilities into the remote state.

Example Statements

   REMOTE 712
   REMOTE Device
   REMOTE @Hpib

Syntax

Item Description Range
I/O path name name assigned to a device or devices any valid name (see ASSIGN)
device selector numeric expression, rounded to an integer (see Glossary)

Semantics

If individual devices are not specified, the remote state for all devices on the bus having remote/local capabilities is enabled. The bus configuration is unchanged, and the devices switch to remote if and when they are addressed to listen. If primary addressing is used, only the specified devices are put into the remote state.

When the computer is the system controller and is switched on, reset, or ABORT is executed, bus devices are automatically enabled for the remote state and switch to remote when they are addressed to listen.

The computer must be the system controller to execute this statement, and it must be the active controller to place individual devices in the remote state.

Bus Actions

Summary of Bus Actions
Interface Select Code Only Primary Address Specified
Active Controller REN REN

ATN

MTA

UNL

LAG

Not Active

Controller

REN Error

REN

Supported On UX WS DOS IN
Option Required None
Keyboard Executable Yes
Programmable No
In an IF ... THEN ... No

REN renumbers the lines in all or part of a program.

Example Statements

REN                 ! Renumbers the entire program by 10s.

REN 1000        ! Renumbers starting at line 1000 by 10s.

REN 100,2       ! Renumbers starting at line 100 by 2s.

REN 261,1 IN 260,Label2       ! Renumbers the range 260-Label2

                                                ! starting with 261 by 1s.

Syntax

Item Description Range
starting value integer constant identifying a program line; Default = 10 or value for beginning line number if specified 1 through 32 766 (1 through 2 147 483 646 for HP BASIC/UX 700)
increment integer constant; Default = 10 1 through 32 767 (1 through 2 147 483 646 for HP BASIC/UX 700)
beginning line number integer constant identifying program line 1 through 32 766 (1 through 2 147 483 646 for HP BASIC/UX 700)
beginning line label name of a program line any valid name
ending line number integer constant identifying program line; Default = last program line 1 through 32 766 (1 through 2 147 483 646 for HP BASIC/UX 700)
ending line label name of a program line any valid name

Semantics

The program segment to be renumbered is delimited by the beginning line number or label (or the first line in the program) and the ending line number or label (or the last line in the program). The first line in the renumbered segment is given the specified starting value, and subsequent line numbers are separated by the increment. If a renumbered line is referenced by a statement (such as GOTO or GOSUB), those references will be updated to reflect the new line numbers. Renumbering a paused program causes it to move to the stopped state.

REN cannot be used to move lines. If renumbering would cause lines to overlap preceding or following lines, an error occurs and no renumbering takes place.

If the highest line number resulting from the REN command exceeds 32 766 (2 147 483 646 for HP BASIC/UX 700), an error message is displayed and no renumbering takes place. An error occurs if the beginning line is after the ending line, or if one of the line labels specified doesn't exist.

RENAME

Supported On UX* WS DOS IN
Option Required None
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

RENAME changes a file's or directory's name.

Example Statements

RENAME "Old_name" TO "New_name"
RENAME Name$ TO Temp$

RENAME "Dir1<SRM_RW_pass>/F1<MGR_pass>" TO "Dir2<RW_pass>/F1"
RENAME "This:REMOTE" TO "That"
RENAME "Dir1/file" TO "Dir2/file"

Item Description Range
old file specifier string expression (see file specifier drawing)
new file specifier string expression (see file specifier drawing)
old directory specifier string expression (see directory specifier drawing)
new directory specifier string expression (see directory specifier drawing)
directory path literal (see MASS STORAGE IS)
file name literal depends on volume's format: 10 characters for LIF; 14 characters for HFS (short file name); 255 characters for HFS (long file name); 16 characters for SRM; (see Glossary)
LIF protect code literal; first two non-blank characters are significant > not allowed
SRM password literal; first 16 non-blank characters are significant > not allowed
volume specifier literal (see MASS STORAGE IS)
directory name literal depends on volume's format: 10 characters for LIF; 14 characters for HFS (short file name); 255 characters for HFS (long file name); 16 characters for SRM; (see Glossary)

Semantics

The new file or directory name must not duplicate the name of any other file in the directory.

SRM files and directories must be closed before being renamed. If an SRM file is not closed and you try to rename it you will get an error.

SCRATCH A also closes all files and directories.

If you try to rename an open DFS, HFS, or LIF file or directory, you will not receive an error.

Because you cannot move a file from one mass storage volume to another with RENAME, an error will be given if a volume specifier is included which is not the current location of the file. However, RENAME can perform limited file-move operations between directories.

If you are using a version of HP BASIC that supports wildcards, you can use them in file specifiers with RENAME. You must first enable wildcard recognition using WILDCARDS. Refer to the keyword entry for WILDCARDS for details. Wildcard file specifiers used with RENAME must match one and only one file name.

LIF Protect Codes

A protected file retains its old protect code, which must be included in the old file specifier.

DFS and HFS Permissions

In order to RENAME a file or directory on an HFS or DFS volume, you need to have W (write) and X (search) permission of the immediately superior directory, as well as X (search) permission on all other superior directories.

SRM Passwords (not supported on HP BASIC/UX 700)

In order to RENAME an SRM file or directory, you need to have M (manager) access capability on the file or directory, R (read) and W (write) capabilities on the immediately superior directory, and R capabilities on all other superior directories.

Including an SRM password in the file or directory specifier does not protect it. You must use PROTECT to assign passwords. You will not receive an error message for including a password, but passwords in the "new file/directory name" portion of the RENAME statement are ignored. However, any existing SRM password is retained by the renamed file or directory.

SRM File and Directory Specifier Length (not supported on HP BASIC/UX 700)

A maximum of nine names (files or directories) are allowed in both file or directory specifiers in the RENAME statement. (The number of names in the old file/directory specifier plus the number of names in the new file/directory specifier must not exceed nine.) No more than six names are allowed in either file specifier individually.

Limited File Moves and Directories

RENAME can be used to move DFS, SRM, and HFS files within and among directories. Directories cannot be moved with RENAME. Moving of files must occur within a single volume. If you move a file with RENAME, the original file is purged.

HP BASIC/UX Specifics

RENAMEing across HFS volumes is allowed.

REORDER

See MAT REORDER.

REPEAT...UNTIL

Supported On UX WS DOS IN
Option Required None
Keyboard Executable No
Programmable Yes
In an IF ... THEN ... No

REPEAT...UNTIL defines a loop which is repeated until the expression in the UNTIL statement is evaluated as true (non-zero).

Example Statements


770  REPEAT
780    CALL Process(Param)
790    Param=Param*Scaling
800  UNTIL Param>Maximum

Syntax

Item Description Range
boolean expression numeric expression; evaluated as true if non-zero and false if zero --
program segment any number of contiguous program lines not containing the beginning or end of a main program or subprogram, but which may contain properly nested constructs(s). --

Semantics

The REPEAT...UNTIL construct allows program execution dependent on the outcome of a relational test performed at the end of the loop. Execution starts with the first program line following the REPEAT statement, and continues to the UNTIL statement where a relational test is performed. If the test is false a branch is made to the first program line following the REPEAT statement.

When the relational test is true, program execution continues with the first program line following the UNTIL statement.

Branching into a REPEAT...UNTIL construct (via a GOTO) results in normal execution up to the UNTIL statement, where the test is made. Execution will continue as if the construct had been entered normally.

Nesting Constructs Property

REPEAT...UNTIL constructs may be nested within other constructs provided the inner construct begins and ends before the outer construct can end.

REQUEST

Supported On UX WS DOS
Option Required IO
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

REQUEST is used to send a Service Request (SRQ) on an HP-IB when the computer is a non-active controller. To request service, the response must have bit 6 set.

Example Statements

REQUEST Isc;Response
REQUEST @Hpib;Bit_6+Bit_0

Syntax

Item Description Range
I/O path name name assigned to an HP-IB interface any valid name
interface select code numeric expression, rounded to an integer 7 through 31
serial poll response byte numeric expression, rounded to an integer 0 through 255

Semantics

To request service, the value of the serial poll response must have bit 6 set; this bit asserts the SRQ line. SRQ will remain set until either the Active Controller performs a Serial Poll or until the computer executes another REQUEST with bit 6 clear.

Only the interface select code may be specified to receive the Request; if a device selector that contains address information, or an I/O path assigned to a device selector with address information is specified, an error results. An error will also results if the computer is currently the Active Controller.

RES

Supported On UX WS DOS
Option Required None
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

RES returns the result of the last numeric calculation which was executed from the keyboard.

Example Statements

Result=RES
IF Last_result=RES THEN PRINT RES

Syntax

RE-SAVE

Supported On UX* WS DOS IN
Option Required EDIT
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

RE-SAVE writes the current HP BASIC program to the specified file in a human-readable ASCII format. If the specified file already exists, the old entry is purged after the new file is written.

Example Statements

RE-SAVE "NailFile"
RE-SAVE Name$,1,Sort
RE-SAVE "Dir<SRM_RW_pass>/File<SRM_RW_pass>" 

Syntax

Item Description Range
file specifier string expression (see drawing)
beginning line number integer constant identifying program line;

Default = first program line

1 through 32 766 (1 through 2 147 483 646 for HP BASIC/UX 700)
beginning line label name of a program line any valid name
ending line number integer constant identifying a program line;

Default = last program line

1 through 32 766 (1 through 2 147 483 646 for HP BASIC/UX 700)
ending line label name of a program line any valid name
directory path literal (see MASS STORAGE IS)
file name literal depends on volume's format (see Glossary)
SRM password literal; first 16 non-blank characters are significant > not allowed
volume specifier literal (see MASS STORAGE IS)

Semantics

An entire program can be saved, or the portion delimited by beginning and (if needed) ending line labels or line numbers. If the file name already exists, the old file entry is removed from the directory after the new file is successfully saved on the mass storage media. Attempting to RE-SAVE any existing file that is not an ASCII, DFS, or HP-UX text file results in an error. (Note that if you RE-SAVE an existing HP-UX text file, a new HP-UX file will be created; the same rule applies to existing ASCII and DFS files).

If the file does not already exist, RE-SAVE performs the same action as SAVE (a new file is created).

Pressing [RESET] during a RE-SAVE operation results in the old file being retained.

If a specified line label does not exist, error 3 occurs. If a specified line number does not exist, the program lines with numbers inside the range specified are saved. If the ending line number is less than the beginning line number, error 41 occurs.

Note that both hard and symbolic links to an HFS file are broken by RE-SAVE (see LINK).

If you are using a version of HP BASIC that supports wildcards, you can use them in file specifiers with RE-SAVE. You must first enable wildcard recognition using WILDCARDS. Refer to the keyword entry for WILDCARDS for details. Wildcard file specifiers used with RE-SAVE must match one and only one file name.

DFS and HFS Permissions SRM Access Capabilities RE-SAVE on SRM Files HP BASIC/UX Specifics

DFS and HFS Permissions

In order to RE-SAVE a file on a DFS or HFS volume, you need to have W (write) permission on the file (if one already exists), W (write) and X (search) permission of the immediately superior directory, as well as X permission on all other superior directories. If a file already exists, its permission bits will be preserved.

SRM Access Capabilities

In order to RE-SAVE an SRM file, you need to have R (read) and W (write) access capabilities on the file (if one already exists), R and W capabilities on the immediately superior directory, and R capabilities on all other superior directories.

If the file exists and is read/write protected, you must specify the correct password with RE-SAVE. If you specify the wrong password on a protected file, the system returns an error. Any existing SRM password is retained by the re-saved file.

If the file does not exist, including an SRM password with the file name does not protect the file. You must use PROTECT to assign a password. You will not receive an error message for including a password, but a password in the file name portion of the RE-SAVE statement will be ignored.

RE-SAVE on SRM Files (not supported on HP BASIC/UX 700)

RE-SAVE opens the remote file in exclusive mode (denoted as LOCK in a CAT listing) and enforces that status on the file until the RE-SAVE is complete. While in exclusive mode, the file is inaccessible to all SRM workstations other than the one executing the RE-SAVE.

Use of RE-SAVE on SRM and HFS may leave temporary files on the mass storage media if [CLR I/O] ([Break]) or [RESET] ([SHIFT]-[PAUSE] or [Shift]-[Break]) is pressed or a TIMEOUT occurs during the RE-SAVE. The file name of the temporary file is a 10-character name (the first is an alpha character, others are digits) derived from the value of the workstation's real-time clock when the interruption occurred. You may wish to check the contents of any such file before purging.

HP BASIC/UX Specifics

The temporary file name begins with RMB followed by the last 4 digits of the HP BASIC/UX process id and 3 digits from the system clock.

If the specified file does not already exist, RE-SAVE will generally create an ASCII type file. However, HP BASIC/UX will create an HP-UX type file when the program is being RE-SAVEd to an HFS volume.

In order to RE-SAVE a file on an HFS volume, you need to have both R (read) and W (write) permission on the file if one already exists. The rest of the HFS permission requirements are the same as mentioned above.

RESET

Supported On UX WS DOS
Option Required IO
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

RESET resets an interface or the pointers of either a mass storage file or a buffer. (For information about RESET as a secondary keyword, see SUSPEND INTERACTIVE.)

Example Statements

RESET 20
RESET Hpib
RESET @Buffer_x

Syntax

Item Description Range
I/O path name name assigned to an interface, mass storage file, buffer, or pipe any valid name
interface select code numeric expression, rounded to an integer 7 through 31

Semantics

A RESET directed to an interface initiates an interface-dependent action; see the "Interface Registers" section for further details.

A RESET directed to a mass storage file resets the file pointer to the beginning of the file.

A RESET directed to a buffer resets all registers to their initial values: the empty and fill pointers are set to 1, and the current-number-of-bytes and all other registers are reset to zero.

If a TRANSFER is currently being made to or from the specified resource, the computer waits until the TRANSFER is complete before executing the RESET. If the TRANSFER is not to be completed, an ABORTIO may be executed to halt the TRANSFER before executing the RESET. If a busy buffer is specified in a RESET statement, error 612 results.

RESTORE

Supported On UX WS DOS IN
Option Required None
Keyboard Executable No
Programmable Yes
In an IF ... THEN ... Yes

RESTORE specifies which DATA statement will be used by the next READ operation.

Example Statements

RESTORE
RESTORE Third_array

Syntax

Item Description Range
line label name of a program line any valid name
line number integer constant identifying a program line; Default = first DATA statement in context 1 through 32 766 (1 through 2 147 483 646 for HP BASIC/UX 700)

Semantics

If a line is specified which does not contain a DATA statement, the computer uses the first DATA statement after the specified line. RESTORE can only refer to lines within the current context. An error results if the specified line does not exist.

RE-STORE

Supported On UX* WS DOS
Option Required None
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

RE-STORE writes the current HP BASIC program to the specified file in a special compact, fast-loading format. If the specified file already exists, the old entry is purged after the new file is successfully stored. RE-STORE can also be used to store typing-aid softkey definitions.

Example Statements

   RE-STORE Filename$&Volume$
   RE-STORE "Prog_a"
   RE-STORE "Dir<SRM_RW_pass>/Prog_z<SRM_RW_pass>"

The following examples require the KBD binary.

   RE-STORE KEY "Typing_aids"
   RE-STORE KEY "KEYS:REMOTE"

Item Description Range
file specifier string expression (see drawing)
directory path literal (see MASS STORAGE IS)
file name literal depends on volume's format (see Glossary)
LIF protect code literal; first two non-blank characters are significant > not allowed
SRM password literal; first 16 non-blank characters are significant > not allowed
volume specifier literal (see MASS STORAGE IS)

Semantics

If the specified file already exists, the old file is removed from the directory after the new file is successfully stored in the current mass storage device. If an old file does not exist, a new one is created as if this were the STORE statement.

Pressing [Reset] during a RE-STORE operation causes the old file to be retained. (See note below for effects on an SRM system.)

Note that both hard and symbolic links to an HFS file are broken by RE-STORE (see LINK).

If you are using a version of HP BASIC that supports wildcards, you can use them in file specifiers with RE-STORE. You must first enable wildcard recognition using WILDCARDS. Refer to the keyword entry for WILDCARDS for details. Wildcard file specifiers used with RE-STORE must match one and only one file name.

LIF Protect Codes

If the old file had a protect code, the same protect code must be used in the RE-STORE operation. Attempting to RE-STORE a file which is the wrong type results in an error. RE-STORE creates a PROG-type file (PROG for HP BASIC on Series 200/300/400; PROG2 for HP BASIC on Series 700). RE-STORE KEY creates a BDAT file.

DFS and HFS Permissions

In order to RE-STORE a file on a DFS or HFS volume, you need to have W (write) permission on the file (if one already exists), W (write) and X (search) permission of the immediately superior directory, as well as X permission on all other superior directories. If the file already exists, its permission bits will be preserved.

SRM Access Capabilities (not supported on HP BASIC/UX 700)

In order to RE-STORE an SRM file, you need to have R (read) and W (write) access capability on the file (if one already exists), R (read) and W (write) capabilities on the immediately superior directory, and R capability on all other superior directories.

If the file exists and is read/write protected, you must specify the correct password with RE-STORE. If you specify the wrong password on a protected file, the system returns an error. Any existing SRM password is retained by the re-saved file.

If the file does not exist, including an SRM password with the file name does not protect the file. You must use PROTECT to assign a password. You will not receive an error message for including a password, but a password in the file name portion of the RE-STORE statement will be ignored.

RE-STORE with SRM Volumes

RE-STORE opens an SRM file in exclusive mode (denoted as LOCK in a CAT listing) and enforces that status on the file until the RE-STORE is complete. While in exclusive mode, the file is inaccessible to all SRM workstations other than the one executing the RE-STORE.

Use of RE-STORE on SRM or HFS may leave temporary files on the mass storage media if [CLR I/O] ([Break]) or [RESET] is pressed or a TIMEOUT occurs during the RE-STORE. The file name of the temporary file is a 10-character name (the first is an alpha character, others are digits) derived from the value of the workstation's real-time clock when the interruption occurred. You may wish to check the contents of any such file before purging.

HP BASIC/UX Specifics

The temporary file name begins with RMB followed by the last 4 digits of the HP BASIC/UX process id and 3 digits from the system clock.

In order to RE-STORE a file on an HFS volume, you need to have both R (read) and W (write) permission on the file if one already exists. The rest of the HFS permission requirements are the same as mentioned above.

RESUME INTERACTIVE

Supported On UX WS DOS
Option Required None
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

RESUME INTERACTIVE restores the normal functions of any program-control keys previously deactivated by SUSPEND INTERACTIVE.

Example Statements

RESUME INTERACTIVE
IF Kbd_flag THEN RESUME INTERACTIVE

Syntax

RETURN

Supported On UX WS DOS IN
Option Required None
Keyboard Executable No
Programmable Yes
In an IF ... THEN ... Yes

RETURN returns program execution to the line following the invoking GOSUB. The keyword RETURN is also used in user-defined functions. See DEF FN and ERROR RETURN.

Example Statements

To return from a GOSUB subroutine:

   RETURN

To return a value from a user-defined function:

   RETURN Value
   RETURN 13774
   RETURN SIN(X)-4*EXP(SIN(PI/Q))
   RETURN File$

Syntax

Using RETURN with GOSUB:

Using RETURN with user-defined functions:

Item Description Range
numeric result numeric expression range of REAL
string result string expression --

Semantics

There may be more than one RETURN statement contained in a user-defined function. The result in the RETURN statement is the value returned to the calling context. The result type, numeric or string, must match the function type (i.e., a numeric function cannot return a string result).

When you exit a multi-line function, the following actions take place:

REV$

Supported On UX WS DOS IN
Option Required None
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

REV$ returns a string formed by reversing the sequence of characters in the specified string argument.

Example Statements

Reverse$=REV$(Forward$)
Last_blank=LEN(A$)-POS(REV$(A$)," ")

Syntax

Semantics

The REV$ function is useful when searching for the last occurrence of an item within a string.

Two-Byte Language Specifics

The string may contain a mixture of one- and two-byte characters.

Certain localized versions of HP BASIC, such as Japanese localized HP BASIC, support two-byte characters. The REV$ function can handle any combination of one- and two-byte characters. The string is reversed on a character-by-character basis. For more information about two-byte characters, refer to the globalization chapters of HP BASIC Porting and Globalization.

RND

Supported On UX WS DOS IN
Option Required None
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

RND returns a pseudo-random number greater than 0 and less than 1.

Example Statements

Percent=RND*100
IF RND<.5 THEN Case1

Syntax

Semantics

The random number returned is based on a seed set to 37,480,660 at power-on, SCRATCH, SCRATCH A, or program prerun. Each succeeding use of RND returns a random number which uses the previous random number as a seed. The seed can be modified with the RANDOMIZE statement. However, for a specific seed value used with RANDOMIZE, each computer platform that runs HP BASIC may produce a different result.

ROTATE

Supported On UX WS DOS IN
Option Required None
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

ROTATE returns an integer which equals the value obtained by shifting the 16-bit binary representation of the argument the number of bit positions specified. The shift is performed with wraparound.

Example Statements

   New_word=ROTATE(Old_word,2)
   Q=ROTATE(Q,Places)

Syntax

Item Description Range
argument numeric expression, rounded to an integer -32 768 through +32 767
bit position displacement numeric expression, rounded to an integer -15 through +15

Semantics

The argument is converted into a 16-bit, two's-complement form. If the bit position displacement is positive, the rotation is towards the least-significant bit. If the bit position displacement is negative, the rotation is towards the most-significant bit. The rotation is performed without changing the value of any variable in the argument.

RPLOT

Supported On UX WS DOS
Option Required GRAPH
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

RPLOT moves the pen from the current pen position to the specified relative X and Y position. It can move the pen with or without drawing a line depending on the pen control parameter.

Example Statements

   RPLOT 10,12
   RPLOT Rel_x,Rel_y,Pen_control

The following examples require the GRAPHX binary.

   RPLOT Array(*)
   RPLOT Shape(*),FILL,EDGE

Syntax

Item Description Range
x displacement numeric expression in current units --
y displacement numeric expression in current units --
pen control numeric expression, rounded to an integer; Default = 1 -32 768 through +32 767
array name name of two-dimensional, two-column or three-column numeric array. Requires GRAPHX any valid name

Semantics

RPLOT moves the pen to the specified X and Y coordinates relative to the local coordinate origin. Both moves and draws may be generated, depending on the pen control parameter. Lines are drawn using the current pen color set by PEN and the current line type set by LINE TYPE.

The local coordinate origin is the logical pen position at the completion of one of the following statements. The local coordinate origin is not changed by the RPLOT statement.

AXES DRAW FRAME GINIT      GRID      IDRAW
IMOVE IPLOT LABEL MOVE      PLOT      POLYGON
POLYLINE RECTANGLE SYMBOL

Lines drawn by RPLOT are clipped at the current clipping boundary. If none of the lines are inside the current clip limits, the pen is not moved, but the logical pen position is updated.

Non-Array Parameters

The specified X and Y displacements information is interpreted according to the current unit-of-measure. Lines are drawn using the current pen color and line type.

If none of the line is inside the current clip limits, the pen is not moved, but the logical pen position is updated.

Applicable Graphics Transformations
Scaling PIVOT CSIZE LDIR PDIR
Lines (generated by moves and draws) X X [4]
Polygons and rectangles X X X
Characters (generated by LABEL) X X
Axes (generated by AXES & GRID) X
Location of Labels [1] [3] [2]

[1] The starting point for labels drawn after lines or axes is affected by scaling.

[2] The starting point for labels drawn after other labels is affected by LDIR.

[3] The starting point for labels drawn after lines or axes is affected by PIVOT.

[4] RPLOT and IPLOT are affected by PDIR.

The optional pen control parameter specifies the following plotting actions; the default value is =1 (down after move). Zero is considered positive.

Pen Control Parameter
Pen Control Resultant Action
-Even Pen up before move
-Odd Pen down before move
+Even Pen up after move
+Odd Pen down after move

Array Parameters

When using the RPLOT statement with an array, either a two-column or a three-column array may be used. If a two-column array is used, the third parameter is assumed to be +1; pen down after move.

FILL and EDGE

When FILL or EDGE is specified, each sequence of two or more lines forms a polygon. The polygon begins at the first point on the sequence, includes each successive point, and the final point is connected or closed back to the first point. A polygon is closed when the end of the array is reached, or when the value in the third column is an even number less than three, or in the range 5 to 8 or 10 to 15. Unexpected results can occur in attempts to FILL a polygon of zero area.

If FILL and/or EDGE are specified on the RPLOT statement itself, it causes the polygons defined within it to be filled with the current fill color and/or edged with the current pen color. If polygon mode is entered from within the array, and the FILL/EDGE directive for that series of polygons differs from the FILL/EDGE directive on the RPLOT statement itself, the directive in the array replaces the directive on the statement. In other words, if a "start polygon mode" operation selector (a 6, 10, or 11) is encountered, any current FILL/EDGE directive (whether specified by a keyword or an operation selector) is replaced by the new FILL/EDGE directive.

If FILL and EDGE are both declared on the RPLOT statement, FILL occurs first. If neither one is specified, simple line drawing mode is assumed; that is, polygon closure does not take place.

If you attempt to fill a figure on an HPGL plotter, the figure will not be filled, but will be edged, regardless of the directives on the statement.

When using a RPLOT statement with an array, the following table of operation selectors applies. An operation selector is the value in the third column of a row of the array to be plotted. The array must be a two-dimensional, two-column or three-column array. If the third column exists, it will contain operation selectors which instruct the computer to carry out certain operations. Polygons may be defined, edged (using the current pen), filled (using the current fill color), pen and line type may be selected, and so forth.

Column 1 Column 2 Operation\Selector Meaning
X Y -2 Pen up before moving
X Y -1 Pen down before moving
X Y 0 Pen up after moving (Same as +2)
X Y 1 Pen down after moving
X Y 2 Pen up after moving
pen number ignored 3 Select pen
line type repeat value 4 Select line type
color ignored 5 Color value
ignored ignored 6 Start polygon mode with FILL
ignored ignored 7 End polygon mode
ignored ignored 8 End of data for array
ignored ignored 9 NOP (no operation)
ignored ignored 10 Start polygon mode with EDGE
ignored ignored 11 Start polygon mode with FILL and EDGE
ignored ignored 12 Draw a FRAME
pen number ignored 13 Area pen value
red value green value 14 Color
blue value ignored 15 Value
ignored ignored >15 Ignored

Moving and Drawing

If the operation selector is less than or equal to two, it is interpreted in exactly the same manner as the third parameter in a non-array RPLOT statement. Even is up, odd is down, positive is after pen motion, negative is before pen motion. Zero is considered positive.

Selecting Pens

An operation selector of 3 selects a pen. The value in column one is the pen number desired. The value in column two is ignored.

Selecting Line Types

An operation selector of 4 selects a line type. The line type (column one) selects the pattern, and the repeat value (column two) is the length in GDUs that the line extends before a single occurrence of the pattern is finished and it starts over. On the CRT, the repeat value is evaluated and rounded down to the next multiple of 5, with 5 as the minimum.

Selecting a Fill Color

Operation selector 13 selects a pen from the color map with which to do area fills. This works identically to the AREA PEN statement. Column one contains the pen number.

Defining a Fill Color

Operation selector 14 is used in conjunction with operation selector 15. Red and green are specified in columns one and two, respectively, and column three has the value 14. Following this row in the array (not necessarily immediately), is a row whose operation selector in column three has the value of 15. The first column in that row contains the blue value. These numbers range from 0 to 32 767, where 0 is no color and 32 767 is full intensity. Operation selectors 14 and 15 together comprise the equivalent of an AREA INTENSITY statement which means it can be used on a monochromatic, gray scale, or color display.

Operation selector 15 actually puts the area intensity into effect, but only if an operation selector 14 has already been received.

Operation selector 5 is another way to select a fill color. The color selection is through a Red-Green-Blue (RGB) color model. The first column is encoded in the following manner. There are three groups of five bits right-justified in the word; that is, the most significant bit in the word is ignored. Each group of five bits contains a number which determines the intensity of the corresponding color component, which ranges from zero to sixteen. The value in each field will be sixteen minus the intensity of the color component. For example, if the value in the first column of the array is zero, all three five-bit values would thus be zero. Sixteen minus zero in all three cases would turn on all three color components to full intensity, and the resultant color would be a bright white.

Assuming you have the desired intensities (which range from 0 through 1) for red, green, and blue in the variables R, G, and B, respectively, the value for the first column in the array could be defined thus:

     Array(Row,1)=SHIFT(16*(1-B),-10)+SHIFT(16*(1-G),-5)+16*(1-R)

If there is a pen color in the color map similar to that which you request here, that non-dithered color will be used. If there is not a similar color, you will get a dithered pattern.

If you are using a gray scale display, Operation selector 5 uses the five bit values of the RGB color specified to calculate luminosity. The resulting gray luminosity is then used as the area fill. For detailed information on gray scale calculations, see the chapter "More About Color Graphics" in the HP BASIC Advanced Programming Techniques manual.

Polygons

A six, ten, or eleven in the third column of the array begins a "polygon mode". If the operation selector is 6, the polygon will be filled with the current fill color. If the operation selector is 10, the polygon will be edged with the current pen number and line type. If the operation selector is 11, the polygon will be both filled and edged. Many individual polygons can be filled without terminating the mode with an operation selector 7. This can be done by specifying several series of draws separated by moves. The first and second columns are ignored and should not contain the X and Y values of the first point of a polygon.

Operation selector 7 in the third column of a plotted array terminates definition of a polygon to be edged and/or filled and also terminates the polygon mode (entered by operation selectors 6, 10, or 11). The values in the first and second columns are ignored, and the X and Y values of the last data point should not be in them. Edging and/or filling of the most recent polygon will begin immediately upon encountering this operation selector.

Doing a FRAME

Operation selector 12 does a FRAME around the current soft-clip limits. Soft clip limits cannot be changed from within the RPLOT statement, so one probably would not have more than one operation selector 12 in an array to RPLOT, since the last FRAME will overwrite all the previous ones.

Premature Termination

Operation selector 8 causes the RPLOT statement to be terminated. The RPLOT statement will successfully terminate if the actual end of the array has been reached, so the use of operation selector 8 is optional.

Ignoring Selected Rows in the Array

Operation selector 9 causes the row of the array it is in to be ignored. Any operation selector greater that fifteen is also ignored, but operation selector 9 is retained for compatibility reasons. Operation selectors less than -2 are not ignored. If the value in the third column is less than zero, only evenness/oddness is considered.

RPT$

Supported On UX WS DOS IN
Option Required None
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

RPT$ returns a string formed by repeating the argument a specified number of times.

Example Statements

PRINT RPT$("*",80)
Center$=RPT$(" ",(Right-Left-Length)/2)

Syntax

Item Description Range
argument string expression --
repeat factor numeric expression, rounded to an integer 0 through 32 767

Semantics

The value of the numeric expression is rounded to an integer. If the numeric expression evaluates to a zero, a null string is returned.

An error will result if the numeric expression evaluates to a negative number or if the string created by RPT$ contains more than 32 767 characters.

Note that RPT$ handles any combination of one- and two-byte characters.

RSUM

See MAT.

RUN

Supported On UX WS DOS IN
Option Required None
Keyboard Executable Yes
Programmable No
In an IF ... THEN ... No

RUN starts program execution at the specified line. If no parameter is specified, the program starts at the beginning.

Example Statements

RUN

RUN 10

RUN Part2

Syntax

Item Description Range
line number integer constant identifying a program line; Default = first program line 1 through 32 766 (1 through 2 147 483 646 for HP BASIC/UX 700)
line label name of a program line any valid name

Semantics

Pressing the [RUN] key is the same as executing RUN with no label or line number.

RUN is executed in two phases: prerun initialization and program execution.

The prerun phase consists of:

If HP BASIC detects an error during prerun, prerun halts and an error message is displayed.

After successful completion of prerun initialization, program execution begins with either the lowest numbered program line or the line specified in the RUN command. If the line number specified does not exist in the main program, execution begins at the next higher-numbered line. An error results if there is no higher-numbered line available within the main program, or if the specified line label cannot be found in the main program.

RUNLIGHT

Supported On UX WS DOS
Option Required CRTX
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

RUNLIGHT turns the runlight indicator at the bottom right of the display off and on.

Example Statements

   RUNLIGHT OFF
   RUNLIGHT ON

Syntax

Semantics

This statement is useful when you want to prevent the runlight indicator from appearing on graphics dumps. The default RUNLIGHT setting is ON after SCRATCH A, BASIC reset, or power-on.