LOCATE Command Example

In the following example, records for customers from Germany are located. The total count is then displayed.

CLOSE DATABASES
OPEN DATABASE (HOME(2) + 'Data\testdata')
USE customer  && Open Customer table
SET TALK OFF

STORE 0 TO gnCount
LOCATE FOR ALLTRIM(UPPER(customer.country)) = 'GERMANY' 
DO WHILE FOUND( )
   gnCount = gnCount + 1
   ? company
   CONTINUE
ENDDO

? 'Total companies Germany: '+ LTRIM(STR(gnCount))