INMAT() looks like it may do the job for you. HTH.
INMAT function
_
SYNTAX
INMAT ( [array] )
DESCRIPTION
Use the INMAT function to return the number of array elements
that have been loaded after the execution of a MATREAD,
MATREADL, MATREADU, or MATPARSE statement, or to return the
modulo of a file after the execution of an OPEN statement. You
can also use the INMAT function after a DIM statement to
determine whether the DIM statement failed due to lack of
available memory. If a preceding DIM statement fails, INMAT
returns a value of 1.
If the matrix assignment exceeds the number of elements
specified in its dimensioning statement, the zero element is
loaded by the MATREAD, MATREADL, MATREADU, or MATPARSE
statement. If the array dimensioning is too small and the zero
element has been loaded, the INMAT function returns a value of
0.
If array is specified, the INMAT function returns the current
dimensions of the array. If array is the null value, the INMAT
function fails and the program terminates with a run-time
error message.
EXAMPLE
DIM X(6)
D='123456'
MATPARSE X FROM D,''
Y=INMAT()
PRINT 'Y= ':Y
*
DIM X(5)
A='CBDGFH'
MATPARSE X FROM A,''
C=INMAT()
PRINT 'C= ':C
*
OPEN '','VOC' TO FILE ELSE STOP
T=INMAT()
PRINT 'T= ':T
This is the program output:
Y= 6
C= 0
T= 23
-Original Message-
From: owner-u2-us...@listserver.u2ug.org
[mailto:owner-u2-us...@listserver.u2ug.org] On Behalf Of Jacques G.
Sent: Friday, 17 April 2009 7:27 AM
To: u2-users@listserver.u2ug.org
Subject: [U2] Re: [UV] Passing a string when a Matrix is expected
I came accross a case in legacy code where a subroutine is defined to accept
some matrixes as parameter ei:
SUBROUTINE FOOBAR(TXT, MAT A, MAT B, MAT C, MAT D, OPTION)
One of the calling programs that makes use of this subroutine does this:
CALL FOOBAR(HELLO, , , , , WORLD)
Instead of passing a matrix, it is passing an empty string.
The result is that in FOOBAR, matrixes A, B, C and D are of size zero. In
FOOBAR there is code that does:
MATBUILD REC.A FROM A USING CHAR(1)
Now the MATBUILD command on a matrix of size zero is giving me an undefined
variable in a test program I wrote but in the program in production, it is
giving me the content of a variable in the program.
I was wondering if there is a way to detect if a matrix is of size zero in
Unibasic.
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
--
Message protected by MailGuard: e-mail anti-virus, anti-spam and content
filtering.
http://www.mailguard.com.au/rr
Click here to report this message as spam:
https://login.mailguard.com.au/report/1xh3PzGPBt/7m4U8ME624iLZKoyw58t7e/0.6
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/