Welcome to jBASE's new documentation site! Many answers to your questions can be found by searching the Knowledgebase or viewing the jBASE Documentation. We also have a Google Group for peer discussion about jBASE. If you are unable to find the information you are looking for, jBASE Support will be glad to assist in resolving your technical problems. Enjoy and please provide comments and feedback .

How can we help you?

INMAT

Description 

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

INMAT( {array} )


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

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


Go back to jBASE BASIC.

Was this article helpful?