Steve,
A minor point on your code. SCAN WHILE !EOF() is from the department of redundancy department. SCAN implies while not EOF(). However SCAN does always start at the top of the file unless there is an explicit WHILE clause or the REST option is specified, so your example code could have been;
...
scan REST
...
endscan
...
no need for WHILE !EOF()