[comp.databases] Invalid Subscript Reference in Fox: Bug or Feature?

englandr@phoenix.Princeton.EDU (Scott Englander) (07/23/89)

I'm trying to include references to functions in statements in a FoxBASE
/Mac program, and i think Fox is seeing them as arrays, for some reason.

Case 1:
replace next (r2-r1) tr2comb with tr2fit() for tr2 <> -99 .and. correlates()

Here, tr2fit() and correlates() are UDF's in the same file as the
program.  This line gives the error message "Invalid Subscript
Reference" when used in a program or on the command line.  I tried macro
substitutions like fit="tr2fit()" and then using &fit in the above line,
but to no avail.  This is a pain, because without the function calls, i
must do "repeat next 1" repeatedly, which is much slower.

Case 2:
procedure correlates
return round(tr2fit(),0) = tr2t

This does not work either, and gives the same error message.  I had to
evaluate the result first, and then return it, in order for it to work.
(I fixed it before trying the reference to it in Case 1.)

It seems to me that replace has no problem with functions that are
separate .prg files (with no procedure statement), but i haven't tried
that here.  Any clues?
-- 

                                               - Scott

timk@xenitec.uucp (Tim Kuehn) (07/24/89)

In article <9563@phoenix.Princeton.EDU> englandr@phoenix.Princeton.EDU (Scott Englander) writes:
>I'm trying to include references to functions in statements in a FoxBASE
>/Mac program, and i think Fox is seeing them as arrays, for some reason.
>
>Case 1:
>replace next (r2-r1) tr2comb with tr2fit() for tr2 <> -99 .and. correlates()

>
>Here, tr2fit() and correlates() are UDF's in the same file as the
>program.  This line gives the error message "Invalid Subscript
>Reference" when used in a program or on the command line.  

What this means is that f-base can't find one of your functions, and since 
the function has the "()" after the keyword it's assuming it's a array 
instead of a function.

A word of caution here! Even thought the F-base dox say you can have procedure
names up to 10 chars long, only use 8 chars for your procedure names. I've 
been nailed by making calls to procedures with names that long and f-base
said that it either didn't exist (and gave the subscript problem) or got it 
confused with another function with the same first 8 chars. Feature or bug, 
I never use more than 8 chars for this reason.
... rest of post deleted ...
>-- 
>
>                                               - Scott


+-----------------------------------------------------------------------------+
|Timothy D. Kuehn	       			       timk@xenitec	      |
|TDK Consulting Services			       !watmath!xenitec!timk  |
|871 Victoria St. North, Suite 217A					      |
|Kitchener, Ontario, Canada N2B 3S4 		       (519)-741-3623 	      |
|DOS/Xenix - SW/HW. uC, uP, DBMS. 		       Satisfaction Gauranteed|
+-----------------------------------------------------------------------------+