>select 0
>use nextref
>goto 1
>*=rlock()
>if rlock()
> goto 1
So you go to the first record, lock it, and then go there again?
If I'm reading this correctly, you have a single record, each field of which stores a different primary key. A better design would be to have multiple records, one for each PK you're generating, and to lock the record with the PK you need.