test for completion of present search or no more records of desired type

while(!found && (ptr != null))