MASS STORAGE IS - MTA

MASS STORAGE IS

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

MASS STORAGE IS specifies the system mass storage device, which is either a disk drive (and directory) or a portion of memory specially configured with INITIALIZE. The MASS STORAGE IS device is used as the implied source or destination for all file-related operations that do not specify an explicit source or destination.

MASS STORAGE IS may be abbreviated as MSI when executed directly from the keyboard.

Example Statements

MASS STORAGE IS Vol_specifier$
MASS STORAGE IS Dir_path$&Vol_specifier$
MSI ":,700"
MSI ":INTERNAL,4,1" !HP BASIC/WS only
MSI ":X,12"
MSI ":REMOTE"
MSI "/Dir1/Dir2/MyDir"
MSI "../.."
MSI ".<SRM_READ_pass>"
MSI ":HFS" ! HP BASIC/UX only
MSI ":DOS" !HP BASIC/DOS only


Syntax

Item Description Range
directory specifier string expression (see drawing)
volume specifier string expression (see drawing)
directory path literal (see drawing)
directory name literal depends on volume's format (14 characters for HFS; 255 characters for HFS long file name systems HP BASIC/UX only); 16 characters for SRM; and SRM/UX; see Glossary for details)
SRM password literal; first 16 non-blank characters are significant (Note: SRM/UX ignores passwords.) > not allowed
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)

SRM or LAN interface select code integer constant identifying the SRM or LAN interface in the workstation 8 through 31

SRM server's node number literal 0 through 63
SRM volume name literal any valid SRM volume name (see Glossary)
SRM volume password literal (Note: SRM/UX ignores passwords.) any valid SRM volume password (see Glossary)
DOS drive designator literal any valid DOS drive designator in the range A through Z (or a through z)

Semantics

All mass storage operations which do not specify a source or destination by either an I/O path name or volume specifier in the file specifier use the current system mass storage device.

MASS STORAGE IS can be abbreviated as MSI when entering a program line, but a program listing always shows the unabbreviated keywords.

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

Device Type

The following table shows the valid device types. Most device types require an optional BIN for the statement to execute.

Device Type Binary\Required
INTERNAL

(Models 226 and 236 only)

MEMORY

none

HP 9121

HP 9133A/B/V/XV

HP 9134A/B/XV

HP 9135 (5 1/4 -inch disk

requires HPIB not FHPIB)

HP 913X HP 9895

DISK &

HPIB or FHPIB

HP 82901

HP 82902

HP 8290X

DISK & HPIB

All CS/80 and SS/80

drives, for instance:

HP 7908

HP 7914

HP 9122

HP 9133D/H/L

HP 9134D/H

HP 9153

HP 7946 etc.

CS80 &

HPIB or FHPIB

REMOTE (SRM) SRM & DCOMM
REMOTE (SRM/UX) SRM & DCOMM

or SRM & LAN

BUBBLE BUBBLE
EPROM EPROM
SCSI SCSI
DOS drive DFS

NOTE
The 98625 Card (which requires the FHPIB binary) cannot be used with external 5 1/4 -inch disks.

If the device type specified is not valid, the system tests the device to determine its type. There are two exceptions to this.

  1. If the device selector is 0 and the device type is invalid, the device type is assumed to be MEMORY.
  2. If the device type is valid and the driver BIN for the device is not loaded, the system considers the device an invalid device type.

If a valid device type is specified and the system finds a different device at the device selector, error 72 occurs.

Non-Disk Mass Storage

Memory volumes are created by the INITIALIZE statement. They are removed by SCRATCH A or by turning off the power. The unit number for a MEMORY volume may be 0 through 31.

The following is for HP BASIC/WS only:

A bubble memory card may have an select code of 8 through 31. (Use of this card requires the BUBBLE BIN.) A bubble memory card is always unit number 0. It is recommended that these cards be given a high hardware-interrupt level to avoid error 314 in overlapped applications.

When writing data into EPROM (requires the EPROM BIN), specify the select code of the EPROM Programmer card that is connected to the desired EPROM memory card. When reading data from EPROM, specify a select code of 0 or use the select code of the currently connected EPROM Programmer card. If the programmer card at the specified select code is not connected to the specified EPROM memory card, an error is reported. If the select code of 0 is used, you must specify "EPROM" in the mass storage unit specifier; otherwise, the system assumes MEMORY.

The unit numbers are given to the EPROM memory cards at power-up according to relative memory addresses. The card with the lowest address is given unit number 0, the card with the next greater address is given unit number 1, and so forth.

MSI with SRM, SRM/UX, and HFS Volumes

With hierarchical volumes (such as SRM, SRM/UX, and HFS), MASS STORAGE IS can also be used to specify the current working directory.

In order to specify an HFS directory as the current working directory, you need to have X (search) permission of the immediately superior directory as well as on all other superior directories.

In order to specify an SRM directory as the current working directory, you need to have READ access capability on all superior directories.

If you specify an SRM volume password in an MSI statement, that password is automatically applied to all accesses that use the default volume (that is, when no volume specifier is included in the file specifier) until a mass storage volume specifier is included in a subsequent MSI. SRM/UX ignores passwords.

An SRM path name is limited to six levels. To MSI to a directory which is more than six levels deep, you must execute two or more MSI statements.

HP BASIC provides an abbreviated form of the msvs to refer to the current SRM directory. ":REMOTE" refers to the SRM directory you booted from, or if you have performed an MSI to the SRM, :REMOTE refers to the last SRM directory used in an MSI statement. If you did not boot from the SRM and you are accessing it for the first time, you should specify the entire msvs.

MSI with DFS Volumes

The DFS binary provided with the HP Measurement Coprocessor provides direct access to the PC's DOS drives. The DOS drive designator is included in the volume specifier (for example: ":DOS,C"). Note that either the forward slash (/) or the back slash(\) may be used in the directory path.

MSI and Driver Binaries

With HP BASIC, executing MASS STORAGE IS requires accessing the volume (since the system cannot determine whether a volume is a LIF or an HFS format). This operation requires that all drivers for the interface, disk, and directory format be present; for instance, you must have HPIB, CS80, and HFS binaries currently loaded in order to MSI to an HFS directory. If media is not present (hence cannot be accessed), HP BASIC assumes the volume is LIF format.

HP BASIC/UX Specifics

HP BASIC/UX provides an abbreviated form of the msvs to refer to the current directory for HFS. ":HFS" refers to the most recent HFS directory used in an MSI command.

HFS is a valid logical device type, and if HFS is specified with a non-HFS device selector, the device selector will be ignored (unless that device selector has been mapped to an HFS directory in the rmbrc environment file; see Installing and Maintaining HP BASIC/UX.).

MAT

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

MAT performs a variety of operations on matrices, and other numeric and string arrays.

Example Statements

MAT Array= A*(Ref=1/3)
MAT String$= (RPT$(" ",80))
MAT Clone= Parent
MAT A= Array1<>Array2
MAT Vector= RSUM(Matrix)
MAT Transposition= TRN(Matrix)
MAT Id!entity= IDN
MAT Des_array(-1:0,2:4)= Sor_array
MAT Array_1= Array_2(-4:1)
MAT Destination(3,*,*)= Source(*,2,*)
MAT Result= REAL(Complex_array)
MAT New_array= IMAG(Complex_array)
MAT Return_ary= CMPLX(Array1,Array2)
MAT Des_ary= CONJG(Complex_array)
MAT Array= ARG(Complex_array)
MAT Matrix_1= (CMPLX(34.56,-23.78))
MAT Magnitudes= ABS(Complex_array)

Semantics

The MAT statement allows you to:

NOTE
If an error occurs during the calculations involved in a MAT assignment the result array will contain only a partial result. Since you will have no idea which entries are valid, the contents of the array should be considered invalid.

Numeric Operations

In the case of operators, the specified operation is generally performed on every array element, and the results are placed in corresponding locations of the result array (the exception is the * operator, which is discussed under Matrix Multiplication, below.) This means that the result array must have the same "size" and "shape" (though not necessarily the same subscript ranges) as the operand array(s). Note that "size" refers to the number of elements in the array and "shape" refers to the same number of dimensions and elements in each dimension, respectively (e.g. both of these subscript specifiers have the same shape: (-2:1,-1:10) and (1:4,9:20)). If necessary, the system will redimension the result array to make it the proper size. The redimensioning can only take place, however, if the dimensioned size of the result array has at least as many elements as the current size of the operand array(s).

When two arrays are operated on, they must be exactly the same size and shape. If not, the computer returns an error. The specified operation is performed on corresponding elements in each operand array and the result is placed in the corresponding location of the result array. Multiplication of the elements of two arrays is performed with a period rather than an asterisk. The asterisk is reserved for matrix multiplication described below.

Relational Operators

Relational operations are performed on each element of the operand array(s). If the relation is TRUE, a 1 is placed in the corresponding location of the result array. If the relation is FALSE, a 0 is recorded. The result array, therefore, consists of all 0's and 1's. Note that the only comparison operators allowed between COMPLEX expressions or arrays are: = and <>.

Complex Operations

Complex functions can be used by the MAT statement to:

The complex functions available with the MAT statement are given below. The arguments used with these functions can be INTEGER, REAL or COMPLEX arrays.

REAL(Array) assigns the real parts of each array element to the corresponding element in the resultant array.
IMAG(Array) assigns the imaginary parts of each array element to the corresponding element in the result array.
CMPLX(Array1,Array2) creates COMPLEX values from two numeric arrays by assigning each element of the first array (Array1) to the corresponding real part of the result array element, and each element of the second array (Array2) to the corresponding imaginary part of the result array element (if it is COMPLEX). If either of the array arguments are COMPLEX arrays, only the real part of that array is used in the creation of the values.
CONJG(Array) computes the conjugate of each COMPLEX array element and assigns this result to the corresponding element in the result array.
ARG(Array) computes the argument of each COMPLEX array element and assigns this result to the corresponding element in the result array.
ABS(Array) computes the absolute value of each COMPLEX array element and assigns this result to the corresponding element in the result array.

Matrix Multiplication

The asterisk is used for two operations. If it is between an array and a numeric expression, each element in the array is multiplied by the numeric expression. If it is between two matrices, it results in matrix multiplication. If A and B are the two operand matrices, and C is the result matrix, the matrix multiplication is defined by:

where n is the number of elements in a column in the matrix A. (This formula assumes that the array subscripts run from 1 through N; in actuality, the computer only requires that the two arrays be the correct size and shape, the actual values of the subscripts are unimportant.)

Note that the subscript values of the result array correspond to the rows of the first operand matrix and the columns of the second operand matrix. Note also that the column subscript of the first operand array is equal to the row subscript of the second operand array. We can summarize these observations in two general rules:

A third rule of matrix multiplication is:

If either array is COMPLEX, the operation is done in COMPLEX math. If one or both operands is REAL, the calculation is done in REAL math. If both operands are INTEGER, the computation is also INTEGER. If the result matrix and the operand matrixes are different types (i.e., one is REAL and the others are INTEGER), the computer makes the conversion necessary for the assignment. However, the conversion is made after the multiplication is calculated, so even if the matrix receiving the result is REAL, the multiplication can generate an INTEGER overflow when the operands are INTEGER matrixes.

The computer allows you to do matrix multiplication on vectors by treating the vectors as if they were matrices. If the first operand is a vector, it is treated as a 1-by-N matrix. If the second operand is a vector, it is treated as an N-by-1 matrix.

Copying Subarrays

A subarray is a subset of an array (an array within an array). A subarray is indicated by a specifier after the array name as follows:


Array_name(subarray_specifier)
Array_name$(subarray_specifier)

For example, to specify the entire second column of a two-dimensional array, use the following subarray:

Array_name(*,2)

Copying subarrays is useful in these situations:

For a complete discussion of this subject, read the section entitled "Copying Subarrays" found in the "Numeric Arrays" chapter of the  HP BASIC Programming Guide manual. (Note that you can also copy subarrays of string arrays.)

Before discussing the rules for subarrays the concept of range needs to be understood as it appears in this text. The two ranges related to subarrays are the subscript range and default range. The subscript range specifies a set of elements starting with a beginning element position and ending with a final element position. For example, 5:8 specifies a range of four elements starting with element 5 and ending at element 8. The default range is denoted by an asterisk (*) and it represents all of the elements in a dimension. For example, suppose you wanted to copy the entire first column of a two dimensional array, you would use the following subarray specifier: (*,1), where * represents all the rows in the array and 1 represents only the first column.

Follow these rules when copying subarrays:

CSUM

The secondary keyword CSUM computes the sum of each column in a matrix and places the results in a vector. The result vector must have at least as many elements as the matrix has columns. If the vector is too large or its current size is too small (and there are enough elements in its original declaration to allow redimensioning), the computer redimensions it. If the result vector and the argument array are different types (i.e., one is REAL and the other is INTEGER), the computer makes the necessary conversion. However, the conversion is made after the column sums are calculated, so even if the vector receiving the result is REAL, CSUM can generate an INTEGER overflow when the argument is an INTEGER array.

IDN

The secondary keyword IDN turns a square matrix into an identity matrix. An identity matrix has 1's along the main diagonal and 0's everywhere else. The matrix must be square.

INV

The secondary keyword INV finds the inverse of a square matrix. A matrix multiplied by its inverse produces an id!entity matrix. The inverse is found by using the pivot-point method. If the value of the determinant (see DET) is 0 after an INV, then the matrix has no inverse--whatever inverse the computer came up with is invalid. If the value of the determinant is very small compared with the elements in the argument matrix, then the inverse may be invalid and should be checked.

If the result matrix is not the same size and shape as the argument matrix, the computer will attempt to redimension it. If it is too large, or its current size is too small (and there are enough elements in its original declaration to allow redimensioning) the computer redimensions it. An error is returned if the computer cannot redimension the result array.

RSUM

The secondary keyword RSUM computes the sum of each row in a matrix and places the values in a vector. The result vector must be large enough to hold the sums of each row. If it is too large, or its current size is too small (and there are enough elements in its original declaration to allow redimensioning) the computer redimensions it. If the result vector and the argument array are different types (i.e., one is REAL and the other is INTEGER), the computer makes the necessary conversion. However, the conversion is made after the row sums are calculated, so even if the vector receiving the result is REAL, RSUM can generate an INTEGER overflow when the argument is an INTEGER array.

TRN

The secondary keyword TRN produces the transpose of a matrix. The transpose is produced by exchanging rows for columns and columns for rows. The result matrix must be dimensioned to be at least as large as the current size of the argument matrix. If it's the wrong shape, the computer redimensions it. The result and argument matrices cannot be the same.

The transpose of an N-by-M matrix is an M-by-N matrix, and each element is defined by switching the subscripts. That is, A(m,n) in the argument matrix equals B(n,m) in the result matrix. (This description assumes that the array subscripts run from 1 through M and 1 through N; in actuality, the computer only requires that the array be the correct size and shape, the actual values of the subscripts are unimportant.)

MAT REORDER

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

MAT REORDER reorders elements in an array according to the subscript list in a vector.

Example Statements

MAT REORDER Array BY Vector,Dimension
MAT REORDER Lines$ BY New_order

Syntax

Item Description Range
array name name of an array any valid name
vector name name of a one-dimensional numeric array any valid name
dimension numeric expression, rounded to an integer; Default = 1 1 through 6;<= the RANK of the array

Semantics

The dimension parameter is used to specify which dimension in a multidimensional array is to be reordered. If no dimension is specified, the computer defaults to dimension 1. The vector must be the same size as the specified dimension and it should contain integers corresponding to the subscript range of that dimension (no duplicate numbers, or numbers out of range). The vector used cannot be a COMPLEX vector, but COMPLEX arrays can be re-ordered.

Vectors generated by a MAT SORT TO statement are of the proper form for reordering (see MAT SORT).

MAT SEARCH

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

MAT SEARCH searches for user-defined conditions within a numeric or string array and places information returned into a variable for recall and examination.

Example Statements

MAT SEARCH Number_array,LOC MAX;Loc_max
MAT SEARCH Source,LOC(<3);Location,4
MAT SEARCH Array(1,*) DES,LOC MIN;Loc_min,6
MAT SEARCH Vector,#LOC(2);Non_two_values
MAT SEARCH String$(*,2,3) DES,MAX;Max_value$
MAT SEARCH Word$(*,2),MIN;Min_plus$[2;10],Start_pos

Item Description/Default Range\Restrictions
numeric arrayname name of a numeric array any valid name
string array name name of a string array any valid name
subscript numeric expression, rounded to an integer -32 768 through +32 767 (see "array" in Glossary)
beginning position numeric expression, rounded to an integer 1 through 32 767 (see "string" in Glossary)
ending position numeric expression, rounded to an integer 0 through 32 767 (see "string" in Glossary)
substring length numeric expression, rounded to an integer 0 through 32 767 (see "string" in Glossary)
return variable name of a numeric or string variable(as appropriate) see Semantics
starting subscript starting location within the vector being searched -32 768 through +32 767 (see "array" in Glossary)

Semantics

Numeric searching comparisons are performed in the INTEGER mode for integer-precision arrays, in the REAL mode for real-precision arrays, and in the COMPLEX mode for complex arrays (which use real-precision for their real and imaginary parts). Note that the only numeric comparisons allowed in the COMPLEX mode are = and <> relational operators.

String arrays can be searched using all of the condition specifiers mentioned above. (If you want to search a substring within each element, see the subsequent discussion of searching substrings.)

The default search order for arrays is from the lower bound to the upper bound. This is considered to be an ascending search order. You can search an array in a descending search order (upper bound to lower bound) by using the secondary keyword DES in the key specifier. The following table clarifies the two types of search orders:

Search Order Starting Subscript\Given No Starting Subscript\Given
ascending

(default)

starting subscript to upper bound lower bound to upper bound
descending

starting subscript to lower bound upper bound to lower bound

The key specifier must be included when the array has more than one dimension, and, for an n-dimensional array, must have one "*" and n-1 subscripts. This creates a one-dimensional slice to be searched.

The remaining sections mainly talk about numeric arrays; however, these sections also apply to searching string arrays.

DES

To search an array by descending subscript values, use the secondary keyword DES in the array's key specifier:

MAT SEARCH Array(1,*) DES,MAX;Max_value,6

This secondary keyword causes a search to begin at the upper subscript bound and proceed toward the lower bound of that same dimension. If a starting subscript is specified in the MAT SEARCH statement, then the search will begin at that specified location in the dimension being searched and proceed toward the lower bound.

LOC(relational comparison)

LOC is used in the MAT SEARCH process for numeric and string arrays to scan the specified locations until it finds the first value which makes the comparison true. The relational comparison it uses is made up of two parts: an operator and a string or numeric expression (e.g. (>10) or (<>"CAT")). Operators determine the type of comparisons made. The following operators may be used: >, <, =, >=, <=, <>. The default relational operator is =.

When LOC is executed the value returned to the return variable is the subscript of the first location found that satisfied the LOC condition.

#LOC(relational comparison)

The condition #LOC is used in the MAT SEARCH process for numeric and string arrays to scan the specified locations and return a count of the number of locations whose contents satisfy the condition. The explanation for the relational comparison for this condition is the same as that given in the previous section.

MAX

MAX is used in the MAT SEARCH process for numeric and string arrays to scan all specified locations to find and return the maximum value found in the search. If the array is a string array, a string value is returned.

LOC MAX

LOC MAX is used in the MAT SEARCH process for numeric and string arrays to scan all specified locations to find and return the subscript of the first location in which the maximum value was found.

MIN

MIN is used in the MAT SEARCH process for numeric and string arrays to scan all specified locations to find and return the minimum value found in the search. If the array is a string array, a string value is returned.

LOC MIN

LOC MIN is used in the MAT SEARCH process for numeric and string arrays to scan all specified locations to find and return the subscript of the first location in which the minimum value was found.

Searching Substrings

To search a substring of each string array element, specify that substring (in square brackets) as part of the key specifier. For example:

     MAT SEARCH A$(*,1)[3,5],LOC("CAT");B$

searches the 3rd through 5th characters of each string for the string value CAT. Note that a MAT SEARCH of string arrays allows you not only to define the elements to be searched, but also to define substrings within each element. Substrings may lie anywhere within the dimensioned size of the string. If a substring lies outside the current string length, the null string is used as the searching key.

MAT SORT

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

MAT SORT sorts an array along one dimension according to lexical or numerical order. In a string array, the current LEXICAL ORDER IS table is used for the sorting comparisons.

Example Statements

MAT SORT Array(Tag,*)
MAT SORT Vals(1,*,3),(2,*,5) DES
MAT SORT Start_vec TO End_vec
MAT SORT String$(*,2)[1;3] TO Order

Item Description Range
numeric array name name of a numeric array any valid name
string array name name of a string array any valid name
vector name name of a one-dimensional numeric array any valid name
subscript numeric expression, rounded to an integer -32 768 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 elements to be compared are defined by a key specifier. The dimension to be sorted is marked with an asterisk, and the subscript values in the key specifier define which elements in that dimension should be used as the sorting values. Once (*), (*) DES, DES, or a blank specifier appears in the list following the array name, no other items can be added. Note that COMPLEX arrays cannot be MAT SORTed, because this statement's sorting routine uses < and > relational comparisons and these comparisons are not allowed with COMPLEX data types.

For multidimensional arrays, when two sort keys are swapped, all elements in their subarrays are swapped, too. For example, if a three-dimensional array is is sorted on (2,*,3), where the values for locations (2,4,3) and (2,7,3) are out of sequence, these two values are swapped. When this happens, the subarrays (*,4,*) and (*,7,*) are also swapped.

In the case of ties, the computer leaves the elements in their current order. However, you can define additional key specifiers to be used for ties. Whenever the computer encounters a tie, it will look to the next (moving from left to right) key specifier to break the tie. It will look at as many key specifiers as necessary to resolve the tie. In theory, there is no limit to the number of key specifiers you can have in one MAT SORT statement. In practice, it is limited by the length of a stored line on the computer you are dealing with. Each key must have an asterisk marking the same dimension.

Normally, the system sorts in ascending order. You can sort in descending order by using the secondary keyword DES. DES applies only to the key specifier which it follows. All others use the default ascending order.

MAT SORT of string arrays allows you not only to define the elements to be sorted, but also to define substrings within each element. Substring specifiers refer only to the key specifier that immediately precedes them. Substrings may lie anywhere within the dimensioned size of the string. If a substring lies outside the current string length, the null string is used as the sorting key.

In addition to actually sorting an array, you can use MAT SORT...TO to store the new order in a vector and leave the original array intact. If the vector is too large, or its current size is too small (and there are enough elements in its original declaration to allow redimensioning) the computer redimensions it. After a MAT SORT TO statement, the array will be unchanged. The vector will contain the subscript values of the sorted dimension in their new order. You can then order the array or other parallel arrays using the REORDER statement. You can also use the contents of the vector to access the original array indirectly.

MAX

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

MAX returns a value equal to the greatest value in the list of arguments. If an array is specified as an argument, then each element of the array is considered a separate value. An INTEGER is returned only if all arguments in the list are INTEGER.

Example Statements

Biggest=MAX(Elements(*))
PRINT MAX(Item1,17,Total/3)
Result=MAX(Floor,MIN(Ceiling,Argument))

Syntax

Item Description Range
array name name of a numeric array any valid name

Semantics

COMPLEX arguments are not allowed with this function.

NOTE
It is possible for the space needed for MAX to exceed the temporary storage allocated for expression evaluation. If the computer is close to overflowing memory this can be a fatal error and can crash the computer. It is recommended that statements including MAX not contain more than 20 variables and constants. An array is counted as one variable.

MAXLEN

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

MAXLEN returns the maximum (declared) length of a string variable in bytes. The declared length is specified in the DIM, COM, or ALLOCATE statement. If you are using ASCII characters, the number of bytes equals the number of characters.

Example Statements

MAXLEN(String$)
N_columns=MAXLEN(String_array$(1))

Syntax

Item Description Range
string variable any simple string variable or subscripted string array element (see Semantics)

Semantics

If the length of a string variable is not explicitly declared (using COM,DIM, or ALLOCATE) before it appears in a program, it will automatically have a length of 18 characters. This function does not return the current length of the variable; use the LEN function for that purpose.

MAXREAL

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

MAXREAL returns the largest positive REAL number available in the range of the computer.

Example Statements

IF X<=LGT(MAXREAL) THEN Y=10^X
Half_max=MAXREAL/2

Syntax

Semantics

The value of MAXREAL is approximately 1.797 693 134 862 32E+308.

MERGE ALPHA WITH GRAPHICS

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

MERGE ALPHA WITH GRAPHICS is used to merge the "simulated" separate alpha and graphics rasters set up by the SEPARATE ALPHA FROM GRAPHICS statement.

MERGE ALPHA gives an error on terminals in HP BASIC/UX. SEPARATE ALPHA gives an error in X on HP BASIC/UX.

Example Statements

MERGE ALPHA
IF done THEN MERGE ALPHA WITH GRAPHICS

Syntax

Semantics

This statement is used to return the simulated separate alpha and graphics rasters on multi-plane bit-mapped alpha displays to their "overlapped" (default) mode. If the display is not a bit-mapped alpha display, an error will be reported.

The statement performs the following actions:

  1. PLOTTER IS CRT,"INTERNAL" is executed.
  2. If the display is a multi-plane, bit-mapped alpha display, then the following actions are also taken; however, note that these actions do not take place when running in the X Window environment.
    1. The alpha mask is set to its maximum value (2^n-1, where n is the number of display planes).
    2. The alpha pen is set to its default color.
    3. The display is cleared (CLEAR SCREEN).
    4. The graphics mask is set to its maximum value (2^n-1, where n is the number of display planes).
    5. The color map is re-initialized (to the default entries)

Here is a HP BASIC program that performs similar configuration of a 4-plane, bit-mapped alpha display:

100 PLOTTER IS CRT,"INTERNAL" ! To enable GESCAPE.
110 ALPHA MASK 15 ! Restore default.
120 CLEAR SCREEN
130 ALPHA ON ! Display alpha plane.
140 GRAPHICS ON ! Display graphics planes.
150 INTEGER Gm(0) ! Set up array for GESCAPE.
160 Gm(0)=15 !
170 GESCAPE CRT,7,Gm(*) ! Restore default.
180 PLOTTER IS CRT,"INTERNAL" ! To reset color map.
190 ALPHA PEN 4 ! Restore default.
200 END

MIN

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

MIN returns a value equal to the least value in the list of arguments. If an array is specified as part of the list of arguments, then each element of the array is considered a separate value. An INTEGER is returned only if all arguments in the list are INTEGER.

Example Statements

Smallest=MIN(Elements(*))
PRINT MIN(Item1,17,Total/3)

Syntax

Item Description Range
array name name of a numeric array any valid name

Semantics

COMPLEX arguments are not allowed with this function.

NOTE
It is possible for the space needed for MIN to exceed the temporary storage allocated for expression evaluation. If the computer is close to overflowing memory this can be a fatal error and can crash the computer. It is recommended that statements including MIN not contain more than 20 variables and constants. An array is counted as one variable.

MINREAL

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

MINREAL returns the smallest positive REAL number available in the range of the computer.

Example Statements

IF X>=LOG(MINREAL) THEN Y=EXP(X)

Syntax

Semantics

The value of MINREAL is approximately 2.225 073 858 507 24E-308.

MOD

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

MOD returns the remainder of a division.

Example Statements

Remainder=Dividend MOD Divisor
PRINT "Seconds =";Time MOD 60

Syntax

Item Description Range
dividend numeric expression --
divisor numeric expression not equal to 0

Semantics

MOD returns an INTEGER value if both arguments are INTEGER. Otherwise the returned value is REAL. COMPLEX arguments are not allowed with this function.

For INTEGERs, MOD is equivalent to X - Y × (X DIV Y). This may return a different result from the modulus function on other computers when negative numbers are involved.

MODULO

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

MODULO returns the integer remainder resulting from a division.

Example Statements

Remainder=Dividend MODULO Divisor
PRINT "Seconds =";Time MODULO 60

Syntax

Item Description Range
dividend numeric expression range of REAL
modulus numeric expression range of REAL, <>0

Semantics

The type of the result is the higher of the types of the two operands. If the modulus is zero, then error 31 occurs. COMPLEX arguments are not allowed with this function. X MODULO Y is equivalent to X-Y×INT(X/Y). The result satisfies:

0 <= (X MODULO Y)  < Y if Y>0

Y < (X MODULO Y) <= 0 if Y<0

MOVE

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

MOVE moves the physical and logical position of the graphics pen to specified X and Y coordinates without drawing a line.

Example Statements

MOVE 10,75
MOVE Next_x,Next_y

Syntax

Item Description Range
x coordinate numeric expression in current units --
y coordinate numeric expression in current units --

Semantics

The pen is raised before the move and remains up after the move. The X and Y coordinates are interpreted according to the current unit-of-measure.

If both current physical pen position and specified pen position are outside current clip limits, no physical pen movement is made; however, the logical pen position is moved to the specified coordinates.

Applicable raphics 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.

MOVELINES

Supported On UX WS DOS
Option Required EDIT and PDEV
Keyboard Executable Yes
Programmable No
In an IF ... THEN ... No

MOVELINES moves contiguous program lines from one location to another. If only one line identifier is specified, only that line is moved.

Example Statements


  MOVELINES 1200 TO 3250
  
  MOVELINES 10,440 TO 540
  
  MOVELINES Label1,Label2 TO Label3

Syntax

Item Description Range
beginning line number integer constant identifying program line 1 to 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 1 to 32 766 (1 through 2 147 483 646 for HP BASIC/UX 700)
ending line label name of a program line any valid name
target line number integer constant identifying program line 1 to 32 766 (1 through 2 147 483 646 for HP BASIC/UX 700)
target line label name of a program line any valid name

Semantics

If the ending line identifier is not specified, only one line is moved.

The target line identifier will be the line number of the first line of the moved program segment. Moved lines are renumbered if necessary. The code (if any) which is "pushed down" to make room for the moved code is renumbered if necessary.

Line number references to the moved code are updated as they would be by a REN command (except external references to non-existent lines are renumbered).

If there are any DEF FN or SUB statements in the moved code, the target line number must be greater than any existing line number.

If you try to move a program segment to a line number contained in the segment, an error will result and no moving will occur.

If the starting line number does not exist, the next line is used. If the ending line number does not exist, the previous line is used. If a line label doesn't exist, an error occurs and no moving takes place.

If an error occurs during a MOVELINES (for example, a memory overflow), the move is terminated and the program is left partially modified.

MOVE WINDOW

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

MOVE WINDOW moves a window to a new location specified in pixel units (0,0 is upper left). This statement can be entered in the HP BASIC/UX/WS editor, but executes only in HP BASIC/UX in X.

Example Statements

MOVE WINDOW 609, 100, 100
MOVE WINDOW My_plot,Xval,Yval

Syntax

Item Description Range
window number numeric expression, rounded to integer 600 through 699
new xpos numeric expression, rounded to integer in pixel units integer
new ypos numeric expression, rounded to integer in pixel units integer

Semantics

This statement is only valid when running under X Windows. It then moves the window specified by the window number to a new location on the CRT. When not in a window system, this statement will cause an error. The specified window must be one created with the CREATE WINDOW statement, or be the root HP BASIC window (number 600).

The new xpos and new ypos parameters specify the new upper left corner position in pixel coordinates. The coordinates 0,0 specifies the upper left corner of the CRT. If the xpos and ypos parameters are greater than the size of the CRT then the window is moved of the screen and no longer visible.

The position of the window within the stack of windows remains the same. The contents of the window are moved with the window. The window is not altered.

MSI

MSI is identical to MASS STORAGE IS.

MTA

See SEND.