Re: C-ISAM switching indexes... Needhelp!
Posted in 1992
Topics: General Discussion
Hi all, David writes in reponse to my original query : >Quoting Walter Zambotti DEC... >-> What I actually have to do is be able to position myself within the data >-> file using a unique index and then use the secondary index >-> to read sequentially from that already chosen starting position. >-> e.g. >-> st{char/int/long/etc}(values, all key fields) ; >-> isstart(File, &MyUniqueKey, EntireKey, &Record, ISEQUAL) ; >-> isread(File, &Record, ISCURR) ; >-> >-> /* should be pointing at first record unless doesn't exist */ >-> >-> isstart(File, &MyOtherKeyNotUnique, EntireKey, &Record, ISEQUAL) ; >-> >-> loop { >-> isread(File, &Record, ISNEXT) ; >-> DoSomethingWith(Record) ; >-> } >Let's say that the unique key is "part_num", and the non-unique key is >"date_entered". You want to seek right to a part number then read the >file sequentially by date entered. Why can't you create a single index >on "part_num, date_entered". This two-part key will allow you to the >following: > st{char/int/long/etc}(values, all key fields) ; > isstart(File, &MyUniqueKey, EntireKey, &Record, ISGTEQ) ; > isread(File, &Record, ISCURR) ; > loop { > isread(File, &Record, ISNEXT) ; > DoSomethingWith(Record) ; > } >DAS >-- >David A. Snyder @ Snide Inc. - Folcroft, PA Current Release Thanks for the answer dave. Unfortunately my simplistic example isn't a true reflection of my real world application. I have already used 8 keys to represent this index with a total of 116 bytes in length. If I add the unique index keys to the non-unique index then I will require another three keys and room for 68 bytes. This unfortunately surpasses the C-ISAM limitation of 120 bytes per index and I think 8 keys per index. Walter