|
Home > Archive > Programming with dBASE > April 2005 > unreasonable error messages
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
unreasonable error messages
|
|
|
| Sometimes when running a program, I get error messages that just don't make sense. The most common is for the error to say that a certain variable is not defined, and refer to a line of the program that has nothing to do with that variable. Usually in t
hese cases, it is a parameter from a previously called subroutine that has nothing to do with the current one. These problems frequently go away for no reason I can see, other times I have to code around the line in question. Sometimes the error will be
one thing for one run, and another error for another run, with no changes to the program.
Right now I have this piece of code:
FOR I = 7 TO 17 STEP 2 && Every two hours from 7 a.m. to 5 p.m.
FN = m_NT + '_' + STR(I,2,0,'0') && FN is name of field holding data
IF .NOT. (ISBLANK(&FN) .OR. &FN = 999 .OR. &FN = -9)
Sum_Sqrs = Sum_Sqrs + &FN^2
Sum_Sqrd = Sum_Sqrd + &FN
ENDIF
ENDFOR
It runs fine as long as m_NT = "S", but when it changes to "D", it stops when it gets to the condition for the IF, with the error message "data type mismatch, expecting character". It's apparently OK with the ISBLANK, but doesn't like the last two condit
ions.
Any ideas?
| |
| *Lysander* 2005-04-16, 3:23 am |
| DMW schrieb:
> Any ideas?
What scope has the variable FN?
And what type it should have. In your example you are first creating a
string, and then comparing it against a numeric type.
try in your command window
fn = 999 + "_"
? fn
? type("fn")
result of the type-request will be "C" for character
Look again at your example, from what I can see, fn can NEVER have the
value 999 (or '999' for that matter), as well as it can never be '-9'.
This is because you ALWAYS put an underscore ('_') into the string.
I hope this helps, but I can not see where m_NT being "S" or "D" should
make a difference.
ciao,
André
| |
| Garry Christensen 2005-04-16, 7:23 am |
| I had something similar once. It turned out to be the table index. There
were a lot of blank records. When I looked at it, I also had indexes on
fields that would often be left blank. I ended up with a hundred thousand
records with the same index entry. No wonder it was slowing down.
Anyway, after a certain point the BDE would just throw it's hands up in
disgust and stop, but the error message would make no sense. I always add
'for not empty(field)' in my indexes now.
I don't know if this applies here, but it's a thought.
See Ya,
Garry
"DMW" <acipenserm@aol.com> wrote in message
news:Sv5bhkhQFHA.900@news-server...
> Sometimes when running a program, I get error messages that just don't
> make sense. The most common is for the error to say that a certain
> variable is not defined, and refer to a line of the program that has
> nothing to do with that variable. Usually in these cases, it is a
> parameter from a previously called subroutine that has nothing to do with
> the current one. These problems frequently go away for no reason I can
> see, other times I have to code around the line in question. Sometimes
> the error will be one thing for one run, and another error for another
> run, with no changes to the program.
>
> Right now I have this piece of code:
>
> FOR I = 7 TO 17 STEP 2 && Every two hours from 7 a.m. to 5 p.m.
> FN = m_NT + '_' + STR(I,2,0,'0') && FN is name of field holding data
> IF .NOT. (ISBLANK(&FN) .OR. &FN = 999 .OR. &FN = -9)
> Sum_Sqrs = Sum_Sqrs + &FN^2
> Sum_Sqrd = Sum_Sqrd + &FN
> ENDIF
> ENDFOR
>
> It runs fine as long as m_NT = "S", but when it changes to "D", it stops
> when it gets to the condition for the IF, with the error message "data
> type mismatch, expecting character". It's apparently OK with the ISBLANK,
> but doesn't like the last two conditions.
>
> Any ideas?
|
|
|
|
|