Odd index related behaviour

This forum is for general support of Xbase++
Post Reply
Message
Author
reganc
Posts: 257
Joined: Thu Jan 28, 2010 3:08 am
Location: Hersham, Surrey, UK
Contact:

Odd index related behaviour

#1 Post by reganc »

The other day we had an issue at one of our customers and I thought I would mention it to see if anyone has seen anything similar.

A record in our stock item database had a product code that was something like 'ABCD+E'. The + (plus) sign in that product code was ASCI character 43.

For some reason, some records written in other related databases contained the same product code except the + (plus) sign was ASCII character 197, which in the old OEM DOS character set is a box character, the one that has the same basic shape as the normal + (plus) sign. And if you viewed the records in index order, the records were shown grouped together as if all the product codes were identical.

What this did was defeat a simple set of code that did:

Code: Select all

seek cProductCode
do while Alias->Code == cProductCode .and. Alias->(!eof()
   // other code here
   Alias->(dbskip(1))
enddo
causing it to stop at a record with a product code containing the 'fake' + (plus) sign.

Once I found this and replaced those 'fake' characters with the real ones, all was ok. But it was a difficult one to pin down at the time.

And the only way I can think of to find these types of issues would be to manually skip through every record in every database we have looking for ASCII characters outside the 33 to 127 range so that they can be replaced.

I don't know where the data came from that allowed this dodgy ascii character into the product code field, but I am guessing it was some sort of data import from some other system.
Regan Cawkwell
Real Business Applications Ltd
http://www.rbauk.com

Post Reply