Subject |
Re: locate works differently 2.8 and 9.5 |
From |
Mervyn Bick <invalid@invalid.invalid> |
Date |
Sat, 24 Jan 2015 16:10:10 +0200 |
Newsgroups |
dbase.getting-started |
On Sat, 24 Jan 2015 12:48:55 +0200, Antti Tanskanen
<antti.tanskanen@elisanet.fi> wrote:
> Hi
>
> I have dbase versions 2.8 8.x and 9.5. I have found that many things
> work differently in these version and maybe there are still some bugs in
> the calculations for running same data gives different results on
> different versions.
>
> Now I discovered that locate don't work the same way: 2.8. works
> correctly and 9.5 seeks all the parameter length (len_) down to 1. The
> idea behind this code is to find a parameter from atcluo file where the
> vnrker is > 0 and the atc code is longest possible (most accurate).
> Any idea why 9.5 (and 8.x) do not work like 2.8 (and as i want).
There are MANY ways in which commands in dBASE 8 and dBASE 9 work
differently to the same commands in dBASE 2.8. Some of these are
intentional, most of them are bugs. You don't say in what way LOCATE in
dBASE 9.5.1 performs differently to LOCATE in dBASE 2.8 but you should
report this in the bug-report newsgroups together with a little program
that shows the problem.
Try the following code which doesn't use the LOCATE command. It loops
through the table looking for a matching record and then uses the GOTO
command to leave the record pointer on the record.
nLen = 7
nRec = 0
select atcluo
for n = nLen to 1 step -1
cSeek = left(vnro-len_->atc,n)
scan
if cSeek = left(atc,nLen) or (cSeek = trim(left(atc,nLen)) and
vrnker > 0)
n = 1 //exit for...next
nRec = recno()
exit //exit scan...endscan
endif
endscan
next
if nRec = 0
msgbox("No match found")
else
goto nRec
endif
Mervyn.
|
|