HP 3000 Manuals

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


HP Business BASIC/XL Reference Manual

MAT READ 

The MAT READ statement assigns values from one or more DATA statements or
a data file to one or more arrays.  If new dimensions are specified for
the arrays, the MAT READ statement redimensions them before assigning
values to them.  It assigns values element by element, varying the
rightmost subscript fastest.  The MAT READ statement cannot take input
from the terminal keyboard.

Syntax 

MAT READ [#fnum[,rnum[,wnum]];] array [dims][, array [dims]]...

Parameters 

fnum             File number of a data file.  If this parameter is
                 specified, the MAT READ statement reads from a data
                 file.  If it not specified, the MAT READ statement reads
                 from DATA statements.  A program line can read from a
                 DATA statement or a file, and a command can only read
                 from a file.  For more information on fnum, see "File
                 Identification," in chapter 6.

rnum             Record number.  If this parameter is specified, the
                 statement performs a direct read on the data file
                 specified by fnum.  For more information on rnum and
                 direct reads, see "File Input and Output," in chapter 6.

wnum             Word number.  If this parameter is specified, the
                 statement performs a direct word read on the file
                 specified by fnum.  That file must be a BASIC DATA file.
                 For more information on rnum and direct word reads, see
                 "File Input and Output," in chapter 6.

array            Structured collection of variables of the same type.
                 The structure is determined when the array is declared.
                 String variables names are suffixed with a "$".

dims             Array dimensions used in syntax specification
                 statements.  Its syntax is

                 (dim1[,dim2[,dim3[,dim4[,dim5[,dim6]]]]])

                 where dim1 through dim6 each have the syntax

                 [num_expr1:]num_expr2 

                 and num_expr1 and num_expr2 are the lower and upper
                 bounds (respectively) of the dimension.  If num_expr1 is
                 not specified, it is the default lower bound.

Examples 

The following examples show the MAT READ statement.  Each reads a group
of arrays into array variables.  In lines 100 and 120, the entire arrays
are read, and in lines 110 and 130 selected elements are read.

     100 MAT READ #1; A,B,C$
     110 MAT READ #2; A(1:3),B(0:4,0:6),C$(3,4,5,6)
     120 MAT READ #1,7; D$
     130 MAT READ #4,6,2; Q,P(9,9),R

If array A has four elements, the following statements are equivalent:

     100 MAT READ #1; A
     100 READ #1; A(*)
     100 READ #1; A(1),A(2),A(3),A(4)
     100 READ #1; (FOR I=1 TO 4, A(I))



MPE/iX 5.0 Documentation