PMBI, assuming that you mean a contiguous block of 1000 ids that have not been used, then maybe this will help
CREATE CURSOR idpool (id i, idused L)
LOCAL i,cntused
FOR i = 1 TO 20000
INSERT INTO idpool (id, idused) VALUES(i,MOD(i,RAND()*100)=0)
ENDFOR
COUNT FOR idused TO cntused
?cntused
LOCATE FOR idused
lnblocktop=RECNO()
lnstartid=id
DO WHILE .t.
CONTINUE
IF RECNO()> lnblocktop+999
?'Found Block of 1000 unused Ids starting with id #'+STR(lnstartid)
EXIT
ELSE
lnblocktop=RECNO()
lnstartid=id
ENDIF
IF EOF()
?"No block of 1000 Unused Ids found."
EXIT
ENDIF
ENDDO
Tom
Life happens, don't blink.