Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!agate!shelby!lindy!news From: AR.HFN@forsythe.stanford.edu (Hooshyar Naraghi) Newsgroups: comp.databases Subject: Re: Clipper/dBase Seek Question Message-ID: <4480@lindy.Stanford.EDU> Date: 23 Aug 89 05:59:41 GMT Sender: news@lindy.Stanford.EDU (News Service) Distribution: usa Lines: 40 In article <238@fltk.UUCP>, dnb@fltk.UUCP (David Buonomo) writes: >I have a .DBF file indexed on 2 numeric fields of 4 and 6 digits respectively. >More specifically, the index is built by: > > index on str(invnum,4)+str(seqnum,6) to idx_file > >I would like to do a seek specifying only the first index. I am currently >unable to accomplish this (result of seek is EOF). Is this possible to do >and if so, how? Unfortunately you did not specify what your SEEK command was, however, I am going to guess what it is by looking at your INDEX command. The STR function takes the numeric field and if the value of this field is LESS THAN 4 DIGITS, say 123, 10, or 5, then it will add leading blanks to make it 4 characters long when returning a character-type data. For example, suppose you have a record whose INVNUM field has value of numeric 123. If you SEEK "123" you will not find this record. However, if you SEEK " 123", the pointer will point to the record. Please note there was a blank space before 123 (in character type). The best thing to do is to index the file by removing the leading blanks. LTRIM function will accomplish that. I know dBXL and FOX and of course dBASEIII+ support this function, but I am not sure about clipper since I do not use it. The command looks like: INDEX on LTRIM(STR(invnum,4)) + LTRIM(STR(seqnum,6)) to idx_file Now, if you seek "123", the pointer will point to the record whose INVNUM value is 123. I hope this can be useful to you. Thanks for your patience. Hooshyar Naraghi Stanford University AR.HFN@forsythe.stanford.edu (415) 723-3790