Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!bionet!ames!hc!lanl!cmcl2!ccnysci!alexis From: alexis@ccnysci.UUCP (Alexis Rosen) Newsgroups: comp.databases Subject: Re: dBase question Keywords: sequential seek Message-ID: <1569@ccnysci.UUCP> Date: 13 Apr 89 06:59:00 GMT References: <6666@bsu-cs.bsu.edu> Reply-To: alexis@ccnysci.UUCP (Alexis Rosen) Organization: City College of New York Lines: 38 In article <6666@bsu-cs.bsu.edu> mithomas@bsu-cs.bsu.edu (Michael Thomas Niehaus) writes: >I hate to ask questions specific to dBase III+, but I need a quick >answer. Here's the situation: > >I have a database that has two indexes, the master index which in unique >and another non-unique index on a string + date combination. I would like >to switch to using the second index as the master (using SET ORDER) to do >a search. To do this, I am doing this series of commands: > >LOCATE FOR .t. && Just point to the first record to initialize locate >SEEK data-to-be-found && To do a quick move to the records that I want >...processing... >CONTINUE && To advance to the next record as per the indexed order > >Can anyone tell me if this is a good idea? If not, how would you go about >this? This is a bad idea. It won't work at all. This is because you are using the wrong commands. In general, the problem is much simpler than you think it is. Locate and Continue are SEQUENTIAL SEARCH COMMANDS!!! Don't use them for this! It is not exactly clear what you're trying to do, but how about this? tmprn = Recno() && preserve current record Pointer Set Order To 2 && use diferent order. Doesn't move pointer. Seek expr && you need not Go Top or anything, this will && find a matching record even if you're past it * Do processing here Set Order To 1 Go tmprn && return to old record If this is not what you want to do, mail me. Moving around in FoxBase (you aren't really using dBase, are you?) is a breeze. --- Alexis Rosen alexis@ccnysci.{uucp,bitnet}