A little theory behind ISAM (indexed sequential access method) will help.

Basically create index file (separate from the datafile) that contains fixed size records. You define the records based on your search requirements but one of the fields is always an offset to the record in the main data file. The index file should always be sorted based on one or more fields.