Re: C-ISAM switching indexes... Needhelp!
Posted in 1992
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 is db4glgen-3.7 UUCP: ..!uunet!das13!dave INTERNET: dave.snyder@snide.com