LOCATE ... BY (AREV Specific)
At 08 JUL 1999 04:57:55PM Matt Sorrell wrote:
I'm having a serious problem with the LOCATE … BY statement in AREV 3.12. I have used this statement dozens of times in other programs, but today I have three new programs that blow up when I try to use it.
Here's the scoop:
I call a function and get a multi-valued array (@FM,@VM) delimited back. I loop through each @FM row, and GOSUB to an internal subroutine. In the internal subroutine, i extract @VM values out of the current row. One of these values is a date in internal julian format. I have another group of totals arrays. I'm totaling information by week, so I use the following logic:
LOCATE MY.DATE IN WTD BY AR USING @FM SETTING POS THEN
END ELSE
END
The first time the LOCATE … BY is run, MY.DATE is obviously not in WTD (it is initialized to null) and the else clause is executed. As long as every other time MY.DATE equals the original value and the THEN clause is executed, everything works flawlessly.
However, as soon as a new date is passed to the LOCATE … BY routine, the system breaks to the debugger with the error message 'RTP33' Line 1 B10 Variable has not been assigned a value. Zero used.
As I said, as long as all dates are the same, it works perfectly, but if I have several different dates, the code explodes.
BTW - In the else clause, if the date is not found I have the following statement:
WTD=INSERT(WTD,POS,0,0,MY.DATE) to insert it and maintain an @FM delimited array.
If anyone can help me out, I would greatly appreciate it.
Matt Sorrell
At 08 JUL 1999 06:14PM Victor Engel wrote:
Is AR a variable? If not, it must be in quotes.
At 08 JUL 1999 06:58PM Matt Sorrell wrote:
Victor,
Thanks a lot. It's those kind of stupid mistakes that will drive a programmer crazy. There are a couple of other statements where the values like that are string literals, not variables and not in quotes. For some reason, I thought LOCATE … BY was that way too. Especially since it worked the first time through.
Anyway, you just saved what hair remains on my head.
Matt
At 09 JUL 1999 12:54PM [email protected] wrote:
Glad to be of help. If for some reason you lose your hair anyway or for another reason, you can purchase some more at my Buy/Sell Hair Board. Maybe you should bookmark the site.