|
Home > Archive > dBASE Bugs > November 2006 > LOCATE (again)
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]
|
|
|
| Please find herewith some routine and its 2 dbf.
The code has been working for years under DBIV.
Its structure is :
do while not eof
put a value into a variable
do something
skip
enddo
Now at the line of reinitialization of the variable (smr=semret), I get an error message. If I change the command portion where one finds the LOCATE command, the bug disappear.
This makes conspicuous the bug of the LOCATE command I already claimed for without any reply.
I also display the code in the following lines :
//TESTB
SELECT B
USE TESTB
GO TOP
DO WHILE .NOT. EOF()
*? noliv,semret
*wait
RSM=SEMRET
MIL=ANNEE
SELECT A
USE CAL&MIL
GO TOP
LOCATE FOR SEM=RSM
DTL=DDATE
IF RSM>1
go top
LOCATE FOR SEM=RSM-1
ENDIF
DTX=DDATE
IF RSM>2
go top
LOCATE FOR SEM=RSM-2
ENDIF
DTC=DDATE
IF RSM>3
go top
LOCATE FOR SEM=RSM-3
ENDIF
DTS=DDATE
? DTL,DTX,DTC,DTS
SELECT B
IF .NOT. empty(DTL)
*={}
REPLACE DDATLIV WITH DTL
IF DDATLIV<DATE()
REPLACE DDATLIV WITH DATE()
ENDIF
IF DATEXP<DATE()
REPLACE DATEXP WITH DATE()
ELSE
REPLACE DATEXP WITH DTX
ENDIF
IF .NOT. empty(DATESPEC)
*={}
IF DATESPEC<DATE()
REPLACE DATESPEC WITH DATE()
ELSE
REPLACE DATESPEC WITH DTS
ENDIF
ENDIF
IF .NOT. empty(DATELC)
*={}
IF DATELC<DATE()
REPLACE DATELC WITH DATE()
ELSE
REPLACE DATELC WITH DTC
ENDIF
ENDIF
ENDIF
SKIP
ENDDO
RETURN
Any comment welcome.
Dom
| |
| kathy kolosky 2006-11-28, 7:23 pm |
| Hi dlit.
I checked with R&D and we found a work around to your issue ....
The error appears to be due to the fact that the locate condition is being
changed
From:
LOCATE FOR SEM=RSM
To:
LOCATE FOR SEM=RSM-1
If you change the code so that both LOCATE commands have the same FOR
condition
and instead modify the value of RSM, then the error doesn't occur.
Here is a modified version that works:
//TESTB - get Database Engine Error: Operation not applicable on Line 10
// during the second iteration of this line.
SELECT B
USE TESTB
GO TOP
DO WHILE .NOT. EOF()
? noliv,semret
*wait
RSM=SEMRET
MIL=ANNEE
SELECT A
USE CAL&MIL
GO TOP
LOCATE FOR SEM=RSM //Line 16 - this does not cause error
DTL=DDATE
IF RSM>1
go top
//only get error with this locate
//even if the first one on line 16
//is commented out. But, if you comment
//out this line .. no error
RSM=RSM-1
LOCATE FOR SEM=RSM
ENDIF
DTX=DDATE
DTC=DDATE
DTS=DDATE
? DTL,DTX,DTC,DTS
SELECT B
SKIP
ENDDO
RETURN
"dlit" <dlitl@wanadoo.fr> wrote in message
news:QYYmLRxDHHA.1212@news-server...
> Please find herewith some routine and its 2 dbf.
> The code has been working for years under DBIV.
> Its structure is :
> do while not eof
> put a value into a variable
> do something
> skip
> enddo
>
> Now at the line of reinitialization of the variable (smr=semret), I get an
> error message. If I change the command portion where one finds the LOCATE
> command, the bug disappear.
>
> This makes conspicuous the bug of the LOCATE command I already claimed for
> without any reply.
>
> I also display the code in the following lines :
> //TESTB
> SELECT B
> USE TESTB
> GO TOP
> DO WHILE .NOT. EOF()
> *? noliv,semret
> *wait
> RSM=SEMRET
> MIL=ANNEE
>
> SELECT A
> USE CAL&MIL
> GO TOP
> LOCATE FOR SEM=RSM
> DTL=DDATE
>
> IF RSM>1
> go top
> LOCATE FOR SEM=RSM-1
> ENDIF
>
> DTX=DDATE
>
> IF RSM>2
> go top
> LOCATE FOR SEM=RSM-2
> ENDIF
>
> DTC=DDATE
>
> IF RSM>3
> go top
> LOCATE FOR SEM=RSM-3
> ENDIF
>
> DTS=DDATE
> ? DTL,DTX,DTC,DTS
>
> SELECT B
> IF .NOT. empty(DTL)
> *={}
> REPLACE DDATLIV WITH DTL
>
> IF DDATLIV<DATE()
> REPLACE DDATLIV WITH DATE()
> ENDIF
>
> IF DATEXP<DATE()
> REPLACE DATEXP WITH DATE()
>
> ELSE
>
> REPLACE DATEXP WITH DTX
> ENDIF
>
> IF .NOT. empty(DATESPEC)
> *={}
>
> IF DATESPEC<DATE()
> REPLACE DATESPEC WITH DATE()
>
> ELSE
>
> REPLACE DATESPEC WITH DTS
> ENDIF
>
> ENDIF
>
> IF .NOT. empty(DATELC)
> *={}
>
> IF DATELC<DATE()
> REPLACE DATELC WITH DATE()
>
> ELSE
>
> REPLACE DATELC WITH DTC
> ENDIF
>
> ENDIF
>
> ENDIF
>
> SKIP
> ENDDO
>
> RETURN
>
> Any comment welcome.
> Dom
>
| |
|
| Thanks for your reply but well, it does not make the work of my initial program and it is quite unsatisfactory.
A better reply was given by Ivar Jenssen in the getting-started section, reinitializing the smr variable at the beginning of the do while job by inserting a "release smr" and by renaming the second alias with its full name "cal&mil->semret" (or semret-1 e
tc...) instead of letting the table just selected by the "select a" before the work of location is done.
See the remarks made by Ivar Jessen under the tilte 'Now I tell you why' in recent discussion about this subject in gettingstarted section.
It is not the first time that locate creates troubles but I ll check whether his remarks solves all relative problems.
Dom
kathy kolosky Wrote:
> Hi dlit.
>
> I checked with R&D and we found a work around to your issue ....
>
> The error appears to be due to the fact that the locate condition is being
> changed
>
> From:
> LOCATE FOR SEM=RSM
>
> To:
> LOCATE FOR SEM=RSM-1
>
> If you change the code so that both LOCATE commands have the same FOR
> condition
> and instead modify the value of RSM, then the error doesn't occur.
>
> Here is a modified version that works:
>
> //TESTB - get Database Engine Error: Operation not applicable on Line 10
> // during the second iteration of this line.
> SELECT B
> USE TESTB
> GO TOP
>
> DO WHILE .NOT. EOF()
>
> ? noliv,semret
> *wait
> RSM=SEMRET
> MIL=ANNEE
>
> SELECT A
> USE CAL&MIL
> GO TOP
> LOCATE FOR SEM=RSM //Line 16 - this does not cause error
> DTL=DDATE
>
> IF RSM>1
> go top
>
> //only get error with this locate
> //even if the first one on line 16
> //is commented out. But, if you comment
> //out this line .. no error
> RSM=RSM-1
> LOCATE FOR SEM=RSM
> ENDIF
>
> DTX=DDATE
>
> DTC=DDATE
>
> DTS=DDATE
> ? DTL,DTX,DTC,DTS
>
>
> SELECT B
>
> SKIP
>
> ENDDO
>
> RETURN
>
> "dlit" <dlitl@wanadoo.fr> wrote in message
> news:QYYmLRxDHHA.1212@news-server...
>
>
|
|
|
|
|