Page 1 of 1

Will RLOCK() cause EOF() returns .T. ?

Posted: Fri Nov 26, 2010 3:14 am
by huangchenmin
Hi everyone
I met a rare situation.
there are program code in attachment.
It was something like following describtion:
1.Inner do while loop work with database B(work area 2) was surrounded in another do while loop.
2.the outer loop work with database A(work area 2).
3.Under specificed condition, record of database a will be locked inorder to process replacement.
4.the record was locked will unlock after replacement process finished.
5.exit loop.
6.back to work area 1 and skip, displaying message depends on EOF().
7. Whenever replacement was executed, EOF() returns .T..

please help!
BEST REGARDS
chen min

Re: Will RLOCK() cause EOF() returns .T. ?

Posted: Fri Nov 26, 2010 1:18 pm
by l3whmg
Hi Chen Min,
Can I suggest to you to use this syntax

IF MSOPD->(EOF()) ...
IF CO03L->(EOF()) ...
IF MSOPD->(RLOCK()) ...
DO WHILE !MSPOD->(EOF()) ...

and then test your program?

In other words, I think its' better to use alias everywhere.

Best regards

Re: Will RLOCK() cause EOF() returns .T. ?

Posted: Sat Nov 27, 2010 4:47 am
by dhaine_adp
Hi,

I never encounter such problem with eof() and with rlock() returning logical TRUE. I took a quick glanced on your posted code. Please check your routine prior to calling the function mentioned on the posted code. Also if you can use alias instead of workarea number, that would help you a lot in trouble shooting problem like this. Luigi is also right by prefixing alias name. Oh, well it is more readable to use statement like this: "select MSOPD", as compared to statement "select 1".

use MSOPD alias MSOPD new
use ANOTHER alias ANOTHER new
use THIS alias THAT new

select MSOPD
got top
while !eof()

select MSOPD
dbskip()
end

Like this my friend, the bug is much easier to track. Happy hunting.....

Regards,

Daany

Re: Will RLOCK() cause EOF() returns .T. ?

Posted: Fri Dec 03, 2010 4:07 pm
by huangchenmin
l3whmg wrote:Hi Chen Min,
Can I suggest to you to use this syntax
.....
Best regards
Thanks for supports

Re: Will RLOCK() cause EOF() returns .T. ?

Posted: Fri Dec 03, 2010 4:07 pm
by huangchenmin
dhaine_adp wrote:Hi,

I never encounter such problem with eof() and with rlock() returning logical TRUE. I took a quick glanced on your posted code........
Regards,

Daany
Thanks for supports