>>The SCAN/ENDSCAN only restores proper alias. It doesn't restore record pointer. I don't know what you're doing but maybe you can use USE ... AGAIN instead of using the same cursor. This way cursor became "local".
>
>This would be a nice enhancement in the SCAN command.
It could also break some code relying on Scan NOT restoring the record pointer.
>As for what I am trying to do, here's the Recursive() method:
>
>
>PARAMETERS tnNumero
>LOCAL lnRecno
>SCAN FOR NoParent=tnNumero
> ...
> lnRecno=RECNO()
> This.Recursive(Numero)
> GO lnRecno
>ENDSCAN
>
>
>So, as you can see, the method is calling itself. The only way I have succeeded to make it work, is by saving my pointer and restoring it back.
This is the way it worked ever since Scan was introduced. Alternately, you could do what Sergey meant:
>
>PARAMETERS tnNumero
>LOCAL lnRecno, lnWA
lnWA=select()
select 0
use (original alias here) again alias ("cur"+tran(tnumero))
>SCAN FOR NoParent=tnNumero
> ...
> This.Recursive(Numero)
>ENDSCAN
use in ("cur"+tran(tnumero))
select (lnWA)
>
So you have a new alias and a new record pointer for it in each level of recursion. And separate buffers for each, as a side effect.