As you have figured out, a SELECT list inside of BASIC is different from a SELECT list at TCL: the BASIC SELECT is a variable in BASIC memory and cannot be acted upon by subsequent TCL SELECTs. The mechanism to save a TCL SELECT list is SAVE-LIST; you can also save a BASIC SELECT list by writing it to the pointer-file because it is just an AM delimited list; but note that each READNEXT "uses up" the list by removing the first element.
...this works:
mylist= ""
for n = 1 to 1000
mylist<-1> = n
next n
open "pointer-file" to pf else stop 201,"pointer-file"
write mylist on pf,"newlist"
execute "get-list newlist"
[404] 1000 items selected out of 1 items.
...and this will work
for n = 1 to 1000
mylist<-1> = n
next n
select mylist to newlist
open "pointer-file" to pf else stop 201,"pointer-file"
write newlist on pf,"newlist"
execute "get-list newlist"
[404] 1000 items selected out of 1 items.
...but this will only save ids 101 - 1000 in the pointer-file 'mylist' because of the READNEXT
mylist = ""
for n = 1 to 1000
mylist<-1> = n
next n
select mylist to newlist
c = 0
loop
readnext id from newlist else exit
c +=1
if c ge 100 then exit
repeat
open "pointer-file" to pf else stop 201,"pointer-file"
write newlist on pf,"newlist"
execute "get-list newlist"
[404] 900 items selected out of 1 items.
BTW, the trick of turning an AM delimited list into a SELECT list and employing READNEXT to get the next list element is is a very fast way to process a large list inside of BASIC.
...cust.list is a AM delimited list of 10,000 (or more) customer ids:
...slow way: gets slower as N increases
max = dcount(cust.list,@am)
for n = 1 to max
read cust.rec from cust.file,cust.id then.... next n
...fast way: last id is just as fast as 1st id
select cust.list to active.list
loop
readnext cust.id from active.list else exit read cust.rec from cust.file, cust.id then... repeat
What if your list is VM delimited instead of AM? Easy, CONVERT is super-fast (like instantaneous even on a 1M+ element array):
convert @vm to @am in cust.list
/Scott Ballinger
Pareto Corporation
Edmonds WA USA