Isam problems

From: Donald Tees (donald_tees_at_sympatico.ca)
Date: 06/18/04


Date: Fri, 18 Jun 2004 10:58:24 -0400

I have just "fixed" a bug that appears to be a comppiler error, and I am
a bit worried that it is going to crop up later and bite us. The
platform is Windows(98), and the compiler is MF NetExpress Version 3.0.
I was wondering is anybody else has seen something similar.

The Isam File had a key length of 120 characters, and was built as a
temporary file by stringing a bunch of fields into that key. The total
length of the fields going into the key varies, but never exceeds 104.

The file is then closed, and re-opened as an input only file. The
process then goes into a loop:

        read sequential
        store key
        read sequential in loop
        restore key, and re-start at stored position.

About halfway through, I got an error that I had an invalid key on the
restore record position using the stored key. My first thought,
obviously, was that somewhere the program had stepped on the stored key.
Not so. I put in a patch storing it in a second place, and doing a
compare of the two versions before the restart. The key from storage was
unchanged.

Second thought ... somewhere in the program, the record had been
deleted. Not so. I made sure the file was only open in input during the
second pass, and also did a file compare of it as built, and after the
error occured.

Finally, in desparation, I reduced the key size by one character. It
worked! (Note that the code has been working for YEARS). I put it back
... it failed. Obviously the storage location was too short ... nope,
not so. The storage location was also 120 characters, and I changed it
to 119 when I changed the key.

It seems that with a key length of 120, it will not work, and with a key
length of 119, it will not. There are alternate keys, but all reading
was being done using the primary. The key I am trying to do the read
with comes out of the file, so there is no way it should be invalid. The
file status is 23, which agrees with the invalid key.

As the saying goes ... WTF? Any ideas, or do we just pray it continues
to work?

Donald