The MAT INPUT statement assigns values from a terminal or
terminal-format file to array elements.

Format

Syntax Rules

Chnl-exp is a numeric expression that specifies a channel
number associated with a file. It must be immediately preceded by a
number sign (#).

The file associated with chnl-exp must be an open
terminal-format file or terminal. If chnl-exp is not
specified, BASIC takes data from the controlling terminal.

Int-exp1 and int-exp2 define the upper bounds of
the array being implicitly created or the dimensions of an existing
array.

If you are creating an array, int-exp1 and
int-exp2 cannot exceed 10.

Remarks

You cannot use the MAT INPUT statement on arrays of more than two
dimensions.

You cannot use the MAT INPUT statement on arrays of data type
DECIMAL or on arrays named in a RECORD statement.

All arrays specified with the MAT INPUT statement must have lower
bounds of zero.

If you do not specify bounds, BASIC creates the array and
dimensions it to (10,10).

If you do specify upper bounds, BASIC creates the array
with the specified bounds. If the bounds exceed (10) or (10,10),
BASIC signals "Redimensioned array" (ERR=105).

To use the MAT INPUT statement with arrays larger than (10,10),
create the input and output arrays with the DIM statement.

When the array exists, the following rules apply:

If you specify bounds, BASIC redimensions the array to the
specified size. However, MAT INPUT cannot increase the total number of
array elements.

If you do not specify bounds, BASIC does not redimension
the array.

For terminals open on channel zero only, the MAT LINPUT statement
prompts with a question mark (?) unless a SET NO PROMPT statement has
been executed. See the description of the SET PROMPT statement for more
information.

Use commas to separate data elements and a line terminator to end
the input of data. Use an ampersand (&) before the line terminator
to continue data over more than one line.

The MAT INPUT statement assigns values by row. For example, it
assigns values to all elements in row 1 before beginning row 2.

The MAT INPUT statement assigns the row number of the last data
element transferred into the array to the system variable NUM.

The MAT INPUT statement assigns the column number of the last data
element transferred into the array to the system variable NUM2.

If there are fewer elements in the input data than there are array
elements, BASIC does not change the remaining array elements.

If there are more data elements in the input stream than there are
array elements, BASIC ignores the excess.

Row zero and column zero are not changed.

For information about graphics input in VAX BASIC, see the MAT
LOCATE and the MAT GET statements in Programming with VAX BASIC Graphics.

Example

The MAT LINPUT statement receives string data from a terminal or
terminal-format file and assigns it to string array elements.

Format

Syntax Rules

Chnl-exp is a numeric expression that specifies a channel
number associated with a file or terminal. It must be immediately
preceded by a number sign (#).

The file associated with chnl-exp must be an open
terminal-format file or terminal. If a channel is not specified,
BASIC takes data from the controlling terminal.

Int-exp1 and int-exp2 define the upper bounds of
the array being implicitly created or the dimensions of an existing
array.

If you are creating an array, int-exp1 and
int-exp2 cannot exceed 10.

Remarks

You cannot use the MAT LINPUT statement on arrays of more than two
dimensions.

You cannot use the MAT LINPUT statement on arrays of data type
other than STRING or on arrays named in a RECORD statement.

If you do not specify bounds, BASIC creates the array and
dimensions it to (10,10).

If you do specify upper bounds, BASIC creates the array
with the specified bounds. If the bounds exceed (10) or (10,10),
BASIC signals "Redimensioned array" (ERR=105).

All arrays specified with the MAT LINPUT statement must have lower
bounds of zero.

To use MAT LINPUT with arrays larger than (10,10), create the input
arrays with the DIM statement.

When the array exists, the following rules apply:

If you specify bounds, BASIC redimensions the array to the
specified size. However, MAT LINPUT cannot increase the total number of
array elements.

If you do not specify bounds, BASIC does not redimension
the array.

For terminals open on channel zero only, the MAT LINPUT statement
prompts with a question mark (unless a SET NO PROMPT statement has been
executed) for each string array element, starting with element (1,1).
BASIC assigns values to all elements of row 1 before beginning
row 2.

The MAT LINPUT statement assigns the row number of the last data
element transferred into the array to the system variable NUM.

The MAT LINPUT statement assigns the column number of the last data
element transferred into the array to the system variable NUM2.

Typing only a line terminator in response to the question mark
prompt causes BASIC to assign a null string to that string
array element.

Example

The MAT PRINT statement prints the contents of a one- or
two-dimensional array on your terminal or assigns the value of each
array element to a record in a terminal-format file.

Format

Syntax Rules

Chnl-exp is a numeric expression that specifies a channel
number associated with a file or terminal. It must be immediately
preceded by a number sign (#).

The file associated with chnl-exp must be an open
terminal-format file or terminal. If you do not specify a channel,
BASIC prints data on the controlling terminal.

Int-exp1 and int-exp2 define the upper bounds of
the array being implicitly created or the dimensions of an existing
array.

The separator (comma or semicolon) determines the output format for
the array.

If you use a comma, BASIC prints each array element in a
new print zone and starts each row on a new line.

If you use a semicolon, BASIC separates each array element
with a space and starts each row on a new line.

If you do not use a separator character, BASIC prints each
array element on its own line.

Remarks

You cannot use the MAT PRINT statement on arrays of more than two
dimensions.

You cannot use the MAT PRINT statement on arrays of data type
DECIMAL or on arrays named in a RECORD statement.

When you use the MAT PRINT statement to print more than one array,
each array name except the last must be followed with either a comma or
a semicolon. BASIC prints a blank line between arrays.

If the array does not exist, the following rules apply:

If you do not specify bounds, BASIC creates the array and
dimensions it to (10,10).

If you specify upper bounds, BASIC creates the array with
the specified bounds. If the bounds exceed (10) or (10,10),
BASIC prints the elements (1) through (10) or (1,1) through
(1,10) and signals "Subscript out of range" (ERR=55).

All arrays specified with the MAT PRINT statement must have lower
bounds of zero.

When the array exists, the following rules apply:

If the specified bounds are smaller than the maximum bounds of a
dimensioned array, BASIC prints a subset of the array, but
does not redimension the array. For example, if you use the DIM
statement to dimension A(20,20), and then MAT PRINT A(2,2),
BASIC prints elements (1,1), (1,2), (2,1), and (2,2) only;
array A(20,20) does not change.

If you do not specify bounds, BASIC prints the entire
array.

The MAT PRINT statement does not print elements in row or column
zero.

The MOD function divides a numeric value by another numeric value and
returns the remainder.

Format

Syntax Rules

Num-exp1 is divided by num-exp2.

Remarks

If you specify values with different data types, BASIC
performs data type conversions to maintain precision.

BASIC returns a function result whose data type is
compatible with the values you supply.

The function result is either a positive or negative value,
depending on the value of the first numeric expression. For example, if
the first numeric expression is negative, then the function result will
also be negative.

Example

The MOVE statement transfers data between a record buffer and a list of
variables.

Format

Syntax Rules

Chnl-exp is a numeric expression that specifies a channel
number associated with a file. It must be immediately preceded by a
number sign (#).

Move-item specifies the variable or array to which or from
which data is to be moved.

Parentheses indicate the number of dimensions in a numeric array.
The number of dimensions is equal to the number of commas plus 1. Empty
parentheses indicate a one-dimensional array, one comma indicates a
two-dimensional array, and so on.

Str-var and str-array specify a fixed length
string variable or array. Parentheses indicate the number of dimensions
in a string array. The number of dimensions is equal to the number of
commas plus 1. You can specify the number of bytes to be reserved for
the variable or array elements with the =int-exp clause. The
default string length for a MOVE FROM statement is 16. For a MOVE TO
statement, the default is the string's length.

If you specify a data type before the FILL keyword, the fill is of
that data type. If you do not specify a data type, the fill is of the
default data type. Data-type can be any BASIC data
type keyword or a data type defined by a RECORD statement. Data type
keywords, size, range, and precision are listed in Table 1-2.

FILL items following a data type other than STRING cannot end with
a dollar sign. FILL items following a data type other than BYTE, WORD,
LONG, QUAD, or INTEGER cannot end with a percent sign.

FILL% indicates integer fill. FILL$ indicates string fill. The
=int-exp clause specifies the number of bytes to be moved for
string FILL items.

Int-exp specifies the number of FILL items to be moved. In
the applicable formats of FILL, (int-exp) represents a repeat
count, not an array subscript. FILL (n), for example,
represents n elements, not n + 1.

You cannot use an expression or function reference as a
move-item.

Remarks

Before a MOVE FROM statement can execute, the file associated with
chnl-exp must be open and there must be a record in the record
buffer.

A MOVE statement neither transfers data to or from external
devices, nor invokes OpenVMS Record Management Services (RMS). Instead,
it transfers data between user areas. Thus, a record should first be
fetched with the GET statement before you use a MOVE FROM statement,
and a MOVE TO statement should be followed by a PUT or UPDATE statement
that writes the record to a file.

MOVE FROM transfers data from the record buffer to the
move-item.

MOVE TO transfers data from the move-item to the record
buffer.

The MOVE statement does not affect the record buffer's size. If a
MOVE statement partially fills a buffer, the rest of the buffer is
unchanged. If there is more data in the variable list than in the
buffer, BASIC signals "MOVE overflows buffer"
(ERR=161).

Each MOVE statement to or from a channel transfers data starting at
the beginning of the buffer. For example:

MOVE FROM #1%, I%, A$ = I%

In this example, BASIC assigns the first value in the
record buffer to I%; the value of I% is then used to
determine the length of A$.

If a MOVE statement operates on an entire array, the following
conditions apply:

The storage size of the array elements and the size of the array
determine the amount of data moved. A MOVE statement that transfers
data from the buffer to a longword integer array transfers the first
four bytes of data into the first element (for example, (0,0)), the
next four bytes of data into element (0,1), and so on.

If the MOVE TO statement specifies an explicit string length, the
following restrictions apply:

If the string is equal to or longer than the explicit string
length, BASIC moves only the specified number of characters
into the buffer.

If the string is shorter than the explicit string length,
BASIC moves the entire string and pads it with spaces to the
specified length.