jaymukh
2nd May 2002, 20:42
How the locking should be done?

Will this code will work or another person still can get the same order number from another login.

select tcmcs047.*
from tcmcs047 for update
where tcmcs047.ckon = tcckon.act.sls
and tcmcs047.grno = :ord.ser
and tcmcs047._compnr = :sale.comp
order by tcmcs047._index1
selectdo
if tcmcs047.blck = tcyesno.no then
set.orno = ord.ser * 100000 + tcmcs047.ffno
endif
tcmcs047.ffno = tcmcs047.ffno + 1
db.update(ttcmcs047, db.retry)
endselect

DSchneider
3rd May 2002, 10:48
Hi jaymukh,
your scipt will work, but there is no guarantee, that it won't collide with other Users.
So you should work with appl.set(), appl.get.user and appl.delete() to set application locks, which will prevent problems with other users.

I hope this helps you

Best Regards
Daniel :)