C-ISAM multi-part isstart key search
Posted in 2000
Topics: General Discussion
Hi everyone, I have a small problem with multi-part key searches using the 'isstart' function in C-ISAM. The target files were created by SE version 5 running under UnixWare 2.1.3. When I use a 1 part key, the isstart function succeeds. However, when I expand the key with key.k_nparts = 2 (or more) it keeps comming back with an error 103 (invalid key or key length). I need to search the index on two fields but when I try more than 1 it constantly fails. Would anybody have any advice on how to make this work. The relevant code fragment from program is as follows: struct keydesc key; char char_record[90]; key.k_flags = ISDUPS; key.k_nparts = 2; key.k_part[0].k_start = 0; key.k_part[0].k_leng = INTSIZE; key.k_part[0].k_type = INTTYPE; key.k_part[1].k_start = 2; key.k_part[1].k_leng = INTSIZE; key.k_part[1].k_type = INTTYPE; stint(88, &char_record[0]); stint(0, &char_record[2]); file_desc = isopen("/se/data.dbs/file", ISMANULOCK+ISINOUT ); isstart(file_desc, &key, 4, char_record, ISGTEQ); Thanks in advance M. Alfakhrany
Mohammed Alfakhrany wrote: > I have a small problem with multi-part key searches using the 'isstart' > function in C-ISAM. The target files were created by SE version 5 running > under UnixWare 2.1.3. When I use a 1 part key, the isstart function > succeeds. However, when I expand the key with key.k_nparts = 2 (or more) it > keeps comming back with an error 103 (invalid key or key length). I need to > search the index on two fields but when I try more than 1 it constantly > fails. Would anybody have any advice on how to make this work. > > The relevant code fragment from program is as follows: > > struct keydesc key; > > char char_record[90]; > > key.k_flags = ISDUPS; > key.k_nparts = 2; > key.k_part[0].k_start = 0; > key.k_part[0].k_leng = INTSIZE; > key.k_part[0].k_type = INTTYPE; > key.k_part[1].k_start = 2; > key.k_part[1].k_leng = INTSIZE; > key.k_part[1].k_type = INTTYPE; > > stint(88, &char_record[0]); > stint(0, &char_record[2]); > > file_desc = isopen("/se/data.dbs/file", ISMANULOCK+ISINOUT ); > > isstart(file_desc, &key, 4, char_record, ISGTEQ); OK, have you verified the keydesc you get back from iskeyinfo() in 7.25 or isindexinfo() in earlier versions? Does any of the keys match your chosen key? If not, that's the problem. I have an index info printing program which I can send you (source) if you really need it. One of the indexes must be created on two smallints which are also the first two columns of the table. -- Yours, Jonathan Leffler (Jonathan.Leffler@Informix.com) #include <disclaimer.h> Guardian of DBD::Informix v1.00.PC1 -- http://www.perl.com/CPAN "I don't suffer from insanity; I enjoy every minute of it!"