sele 1                       
use sdarti index sdarti alias ar
sele 2
use c:\dbxl\afjp\res\reserv
index on codearti to tmpres
sele 1
do while .not. eof()
prod=codeart
reser=0
sele 2
find &prod
if .not. found()
sele 1
skip
loop
endi
do while .t.
if codearti=prod
reser=reser+q2
skip
loop
else
exit
endi
enddo
sele 1
replace ar->res with reser
skip
enddo
close data
retu

