The following example uses SEEK and LOCATE in combination to find the first vendor in Texas that is not in either Dallas or Houston. The table is indexed on state and city, but you cannot use SEEK alone to find a matching record.

use VENDOR order STATE_CITY

if seek( "TX" )

   locate while STATE == "TX" for CITY # "Dallas" .and. CITY # "Houston" 

   if found( ) 

      *-- Do something 

   endif 

endif

If SEEK( ) finds a vendor in Texas, the WHILE clause of the LOCATE command restricts the sequential search to Texas. The FOR clause looks for the city match, (or non-match in this case).