Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Numeric format in Btrieve?

Numeric format in Btrieve?

Numeric format in Btrieve?

I'm ready to admit that I'm pretty much lost.

I'm working on a report for a friend so that they can get functionality the vendor does not provide....  basically something so that they can see a particular customer's order history for the last period as compared to the same period last year...  so they can maintain appropriate inventory levels.

No DDFs, no help from the vendor.  I've used DataTools with great success... but now I'm stuck.

For any given invoice, all line items are stored in a single variable-length field.  Each line item record itself is 35 bytes in length. I know that the item number is ten digits, and proceeded by 00 80 3f f0 or 00 80 3f f8... not sure the significance of that...

What I'm trying to figure out is... I KNOW the quantity for each line item is 32 bits long.  I know that if I look at the quantity 1, it will be 10 27 00 00.  I initially thought that the first byte was my first significant digit, but that theory goes out the door after 16.

I also reasoned that the second third byte had to do with how many times the number could be evenly divided by 7, but that pattern, too, eventually goes out the window.

If anybody has any ideas... I would gladly owe you a beer... because I'm stuck.

Pervasive/BTRIEVE is not my strong point.. and I'm sure that my modern rdbms-spoiled-self is missing something.

I just don't know what.


RE: Numeric format in Btrieve?

It sounds like the quantity is not stored as an integer but possibly as a decimal or numeric or even a custom format the developer of the application uses.  You posted the quantity 1 as 10 27 00 00 (this maps to 10,000 in decimal).  What is the value of the quantity 2?  Is it 20 4E 00 00 (this is 20,000)?  What application is used to populate the data?

Here's a pretty good description of all of the Btrieve key types including how the bytes are structured for each one:

Certified Pervasive Developer
Certified Pervasive Technician

RE: Numeric format in Btrieve?

You, sir, are brilliant.

I actually put a link in my post to a sample of the data, but you nailed it without it...  my hat is off to you.

I don't know why I didn't see it...  but now I see it is because I was working forward from the data I was expecting, rather than backward from the data I had.  I was expecting 1 to be 01 00 00 00, rather than 10 27 00 00.  I even went to the trouble of writing a little utility to convert a number input into different packed formats... short/long/int/double... when what I should have done is written it to convert a hex input into different unpacked formats.

The dangers of spinning your wheels, I suppose.

Thank you.

RE: Numeric format in Btrieve?

Thanks for the star. Glad you got it all figured out.  Because I've worked with Btrieve / PSQL for over 15 yrs, I've seen all kinds of data types and data type algorithms.  I was just lucky with your data.

Certified Pervasive Developer
Certified Pervasive Technician

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close