Resume a pending LOCATE
CONTINUE is a database command that searches from the current record position for the next record meeting the most recent LOCATE condition executed in the current work area. It terminates when a match is found or end of file is encountered. If CONTINUE is successful, the matching record becomes the current record and FOUND() returns true (.T.); if unsuccessful, FOUND() returns false (.F.).
Each work area may have an active LOCATE condition. In Harbour, a LOCATE condition remains pending until a new LOCATE condition is specified. No other commands release the condition.
. Scope and WHILE condition: Note that the scope and WHILE condition of the initial LOCATE are ignored; only the FOR condition is used with CONTINUE. If you are using a LOCATE with a WHILE condition and want to continue the search for a matching record, use SKIP and then repeat the original LOCATE statement adding REST as the scope.
. This example scans records in Sales.dbf for a particular salesman and displays a running total sales amounts: LOCAL nRunTotal := 0 USE Sales NEW LOCATE FOR Sales->Salesman = "1002" DO WHILE FOUND() ? Sales->Salesname, nRunTotal += Sales->Amount CONTINUE ENDDO . This example demonstrates how to continue if the pending LOCATE scope contains a WHILE condition: LOCAL nRunTotal := 0 USE Sales INDEX Salesman NEW SEEK "1002" LOCATE REST WHILE Sales->Salesman = "1002"; FOR Sales->Amount > 5000 DO WHILE FOUND() ? Sales->Salesname, nRunTotal += Sales->Amount SKIP LOCATE REST WHILE Sales->Salesman = "1002"; FOR Sales->Amount > 5000 ENDDO
EOF(), FOUND(), LOCATE, SEEK