Jump to content
Sign in to follow this  
Tzel

C-ISAM Binary Float/Double from file problem

Recommended Posts

Tzel

Ok.. Im trying to convert an old (very old) C-ISAM file (from a SCO Unix box) into plain text (a must for the first step which is checking the data and manipulating it first) for integrating it into a newer SQL system.

I can parse the file absolutely fine in terms of fields and there are only 9 fields per record, however the value (currency) fields are driving me up the wall. So far ive been unable to even come close to converting them to a normal readable float/double.

Below I have placed some examples of the values in the fields as encoded in the file and what they should read when converted. The float/double fields consist of 8 bytes, am i interpreting it wrong to take them all as one value? is the field split in two?, if so can someone enlighten me please.

0x0000000000A07940 - 410

0x0000000000608D40 - 940

0x00000000204ED440 - 20792.5

0xAE47E17A14B66240 - 149.99

Any help/code will be greatly appreciated as this is slowly driving me round the twist, it doesn't help that its not often I have to deal directly with binary values so for once im just a little blind on this one.

Thanx in advance

Share this post


Link to post
Share on other sites
Tzel

Update...

I just realised that where the field ends in hex 40 (ASCII '@') it means that the record is NOT a negative value, they end in hex C0 if they ARE negative.. I would still appreciate some help as this is still giving me trouble, however i will tweak a few things and see if this makes any of my many previous failed attempts look more promising.

Share this post


Link to post
Share on other sites
Tzel

Thanks for the code ill try it now.

Share this post


Link to post
Share on other sites
Tzel

All I can say is thank you so much... that worked perfectly... and you were right... I read the wrong line on that conversion, my bad.

Thank you again, I may even go as far as to write an adaptive/adaptable C-ISAM data file converter at some point and will post on the forums if I do.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×