Topic group Related topics
Specifies where to move the record pointer after a SEEK or SEEK( ) operation fails to find an exact match.
SET NEAR on | OFF
Use SET NEAR to position the record pointer in an indexed table close to a particular key value when a search does not find an exact match. When SET NEAR is ON, the record pointer is set to the record closest to the key expression searched for but not found with SEEK or SEEK( ). When SET NEAR is OFF and a search is unsuccessful, the record pointer is positioned at the end-of-file.
The closest record is the record whose key value follows the value searched for in the index order, toward the end-of-file. When SET DELETED is ON or a filter is set with the SET FILTER command, SET NEAR skips over deleted or filtered-out records in determining the record nearest the key value expression. The record pointer will be at the end-of-file if search value comes after the key value of the last record in the index order.
With SET NEAR ON, FOUND( ) and SEEK( ) return true for an exact match or false for a near match. With SET NEAR OFF, FOUND( ) and SEEK( ) return false if no match occurs.
Use either the findKey( ) or findKeyNearest( ) method of the Rowset object.