>sele csrtable >go top >do while .not. eof() > rch = csrkey > sele employee > go top > locate for rch=ckey > if found() > lc = locfle > sele csrtable > replace locfle with lc > enddo > skip >enddo >For a start, you could use a SCAN, which saves several commands:
sele csrtable scan rch = csrkey sele employee go top locate for rch=ckey if found() lc = locfle sele csrtable replace locfle with lc enddo enddoNext, you should use full commands (select instead of sele), and give your variables meaningful commands. Also, use variable naming conventions, and make sure your variables are declared. I'll omit renaming the variables for now.
select csrtable scan rch = csrkey select employee locate for ckey = rch if found() lc = locfle select csrtable replace locfle with lc enddo enddoIn your original code, you forgot to unconditionally go back to alias csrtable. (With SCAN, this is implicit.)