# INMAT

Updated: 10/19/2021, 9:29:48 PM
Created: 10/19/2021, 9:29:48 PM
Last Updated By: Kevin Munoz
Read Time: 1 minute(s)

# Description

The INMAT function returns the number of dimensioned array elements. It takes the general from:

INMAT( {array} )
1

Using the INMAT function, without the 'array' argument, returns the number of dimensioned array elements from the most recent MATREAD, MATREADU, MATREADL or MATPARSE statement. If the number of array elements exceeds the number of elements specified in the corresponding DIM statement, the function will return zero. Using the INMAT function with the 'array' argument, returns the current number of elements to the dimensioned 'array'.

In some dialects the INMAT function is also used to return the modulo of a file after the execution of an OPEN statement, which is inconsistent with its primary purpose and not implemented in jBASE. To achieve this functionality use the IOCTL function with the JIOCTL_COMMAND_FILESTATUS command.

An example of use is as:

OPEN "CUSTOMERS" TO CUSTOMERS ELSE STOP 201, "CUSTOMERS"
DIM CUSTREC(99)
ELEMENTS = INMAT(CUSTREC) ; * Returns the value "99" to the variable ELEMENTS
ID = "149"
MATREAD CUSTREC FROM CUSTOMERS, ID THEN
    CUSTREC.ELEMENTS = INMAT() ;
END
1
2
3
4
5
6
7

This returns the number of elements in the CUSTREC array to the variable CUSTREC.ELEMENTS.

Go back to jBASE BASIC

Go back to Programmers' Reference Guide