HP 3000 Manuals

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


HP Business BASIC/XL Reference Manual

MAT PRINT 

The MAT PRINT statement prints one or more arrays to the standard list
device or a data file.  It prints them element by element, varying the
rightmost subscript fastest.

Syntax 

For printing to a string variable or the standard list device:

                [{,}      ]   [,]
MAT PRINT array [{;} array]...[;]

For printing to a data file:

                                     [{,}      ]   [{,}    ]
MAT PRINT #fnum[,rnum[,wnum]]; array [{;} array]...[{;} END]

Parameters 

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 "$".

fnum             File number of a data file.  For more information, see
                 "File Identification," in chapter 6.

rnum             Record number.  If specified, the statement performs a
                 direct write 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 specified, the statement performs a
                 direct word write 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.

{,|;}            Determines spacing between elements of preceding array,
                 if array is a numeric array.  If a comma follows array,
                 each element is printed at the beginning of a
                 20-character field.  If a semicolon follows array,
                 elements are separated by two spaces.  Each string array
                 element is printed on a separate line.

END              Statement prints EOF after last element of last array.
                 File must be ASCII or binary.

The following statements can also print arrays:

     DISP, PRINT
     DISP USING, PRINT USING

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

     100 MAT PRINT A
     100 PRINT A(*)
     100 PRINT A(1),A(2),A(3),A(4)
     100 PRINT (FOR I=1 TO 4, A(I))

The following shows an example of printing an array with MAT PRINT.

     >list
      !  mprtexam
           5 OPTION BASE 1
          10 DIM A(2,2)
          20 A(1,1)=0
          21 A(1,2)=0
          22 A(2,1)=0
          23 A(2,2)=0
          30 MAT INPUT A
          40 MAT PRINT A
     >run
     ?1,2,3,4
      1                   2

      3                   4



MPE/iX 5.0 Documentation