I've been using this technique for a while. I thought that the SCAN FOR would start at the top of the file and act as a filter only looking at records that meet the condition and the WHILE would cause the loop to end as soon as its condition was false.
This is just a bogus example to illustrate the point.
lnInvoiceHdrId = Invoice.iInvoiceHdrId
llTableUpdateOk = .T.
SELECT InvoiceDtl
SCAN FOR InvoiceDtl.iInvoiceHdrId = lnInvoiceHdrId WHILE ;
llTableUpdateOk
llTableUpdateOk = TABLEUPDATE( .F., .F., "InvoiceDtl" )
ENDSCAN
I thought that this would start at the top of the file and find all Invoice details that matched that Id and continue until it hits the end of the file or when the tableupdate fails.
Similaray SCAN has an implicit WHILE NOT EOF() by itself.
So does the SCAN WHILE without a FOR start at the top of the file or does it start from the current record positioning and move forward?