Btrieve database conversion

  • First of all, aim for intermediate format, either fixed-width fields or comma separated ASCII file dump of each Btrieve database. This allows you to divide your data conversion task into two separate steps with less unknowns to battle with. Once you have the data in ASCII files, you can reformat, filter, and preprocess it so that you can import the data directly into your new system. In real life you probably have to do this process twice, once for testing and development, and then again when you are switching over to new system. If this is what you need, then by all means take your time to build tools that can completely automate the export and conversion process so that your downtime at switchover will be minimal.
  • Now, if you have source code of your application your best choice is to look at it to find out what the record structure is and write a trivial for each database to export all records into ASCII dump. You basically just open a database using Btrieve API, step through all records writing a formatted string into export file, and close a file.
  • If you do not have source code, look for DDF files. The problem with Btrieve databases is that the database itself does not contain information about record layout in it. It does contain information about keys (index fields in the record) but nothing more. When higher-level stuff was built on top of Btrieve (specifically Xtrieve, if my memory serves me right) people finally found out that this was not good, and they created special Btrieve databases to describe record layout of other databases. These are FILE.DDF, FIELD.DDF and INDEX.DDF. The most important one is FIELD.DDF which describes record layout of each database. However, it uses an ID number for each, so you need FILE.DDF so that you can look up the file by its name. INDEX.DDF actually duplicates the data that is present in Btrieve database itself, too. Oh, and the first files that the DDF files usually describe are the DDF files themselves. If you have DDF files, then you can probably extract your data with ready-made tools, yo can start by trying out some of those I have available on development tools page. You can even dig into your wallet and by Pervasive SQL which should be able to access your database using the DDF files, so that you can use ODBC drivers to access your data directly. But this is probably not the way you want to go as the whole point is to get rid of Btrieve, not to buy in some more of it, right?
  • If you do not have source code, and you also don't have DDF files, but you have a documentation about Btrieve file record structures, then your best option is to build the DDF files yourself (or write custom code to export the data, but in that case you need the tools to compile that code). You can probably accomplish that with tools you can get from development tools page.
  • If you had to read this far, then you next best move is probably to hire someone to do the job for you. The developer who wrote the old application is best choice, of course. In case that person is unavailable, look for someone with prior experience with this problem - he or she will probably have tools and knowledge to get the job done much quicker than you can do it yourself.
  • Now, if you do not have anyone to help you, any documentation, source code, nor DDF's then you are pretty much screwed. You basically have to reverse engineer each of your databases to figure out the record layout, and then either write some code to export data or you have to build DDF's. Smithware had a tool named DDF Sniffer, which did a pretty good job on automating a DDF creation process for most of the databases. However, this was not a foolproof process for trickier record layouts, and the old copy that I once used crashed on some databases, too. Generally, it was a useful tool, though. I have no idea what happened to the product, Smithware was bought by Pervasive quite a while ago, if I remember correctly.
  • If you cannot get DDF Sniffer or a similar tool, then get BTFILER from development tools page, load BREQUEST or BTRIEVE or whatever you use, and take a look at some of the records. Compare what you see with what you have on your application screen. Drink lots of black coffee or whatever keeps you ticking, take frequent stretching breaks, swear if you have to. Believe in yourself. You can do it...

So here you are, this is about all I can tell you about getting your data off Btrieve databases.

05 Feb 2002
Madis Kaal <mast@nomad.ee>

Copyright © Madis Kaal 2000-