Set Near, Set("Near")

Peace to him that is far off, and to him that is near.

The Bible

This command determines what happens when a search fails. With SET NEAR OFF, the record pointer goes to end of file. SET NEAR ON moves the record pointer to the closest matching record.

Usage

SET NEAR ON | OFF
cNear = SET( "NEAR" )
SET NEAR applies only to searches involving SEEK (and its cousins, SEEK() and INDEXSEEK()), plus the antique FIND. Searches with LOCATE and implied searches due to relations between tables ignore SET NEAR."Closest matching record" means the first record after the desired value, that is, the next highest value in an ascending index and the next lowest in descending order. With NEAR OFF, you can use RECNO(0) to explicitly move the record pointer to where you'd have been with NEAR ON.SET("NEAR") tells you the current setting, so you can change it, then reset it. SET NEAR is one of the many settings scoped to a data session.

Example

SET NEAR ON
USE Employee ORDER Last_Name
* An honest man would be handy
SEEK "DIOGENES"
BROWSE  && Record pointer is on record for Anne Dodsworth

See Also

Find, RecNo(), Seek, Set, Set Exact, Set Order


Back to Table of Contents

Copyright © 2002-2018 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. Click for license .