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


Extracting data from Btrieve dta files (DOS)

Extracting data from Btrieve dta files (DOS)

Extracting data from Btrieve dta files (DOS)


I am looking to extract data from Btrieve dta files (running in DOS) ideally into Access or Excel. I realise that we can't link directly using ODBC as this version doesn't seem to support this?

Is there any way to directly dump out the data from these files in a usable format (csv, txt etc)??

Any help would be appreciated.

Thanks in advance


RE: Extracting data from Btrieve dta files (DOS)

There's no easy way to do this. Btrieve does not store field information so the best you can do with Btrieve utilities would be a byte image of the record.  Might work if most of the fields are strings but numeric data types will be binary.  
If you know the record structure, you might look into third party tools to create DDFs and then use a newer version of Btrieve/Pervasive to export the data.
You could also write a program to read the data files and write them out to whatever format you want.

Custom VB and Btrieve development.
Certified Pervasive Developer
Certified Pervasive Technician

RE: Extracting data from Btrieve dta files (DOS)


Thanks for your info, it is what i was expecting.

We have an export system that does export the data, but it is in a 'list' format. It may be easier to write something to adapt this structure to what i require.


RE: Extracting data from Btrieve dta files (DOS)

If you need to create your DDF files you an try BtSearch at www.nssdd.com.  It allows you to analyze the structure and build the DDF files.  Once built it will export to dbase or ascii formats.


RE: Extracting data from Btrieve dta files (DOS)

I have been doing this sort of extraction myself, with a legacy Btrieve system (6.1.5), flattening the files and normalizing them for insertion into Oracle tables through sql loader.

The flattening process is somewhat tricky, but you can get around it if you're willing to jump through a few hoops.

I wrote a BAT file that does the following (I've removed the pathing for simplicity):


This flattens the Btrieve file CCXYZ.DAT into CCXYZ.TXT.

CCXYZ.TXT contains two comma-separated fields:
record length
record content

Trivially, I used -RECOVER rather than -SAVE because I didn't want to jack with key issues. (I can get lazy sometimes!)

I wrote a VBscript that calls the BAT file, then normalizes the variable-length records to fixed-length by stripping the length field and comma, padding the record to the maximum length (using zeroes rather than spaces, if my table columns contain numeric definitions), and then loading the resulting files into Oracle with the sql load utility. If you have any binary/packed numeric data fields, your VBScript might want to comprehend those and turn them into something that won't choke Excel. Keep this in mind, however. The binary value might get read as something that chokes the normal sequential file "Line Input" command, and you may be forced to open the file as binary. Not that this is a problem, but just be prepared for it.

The upside of jumping through all these hoops is that you can also normalize -- or delimit -- your fields for smooth loading into yor spreadsheet. Once you have flattened the file, you can manipulate it as you need.

Three caveats about BTRIEVE and BUTIL:
1. The 1997 version of BTRIEVE works better than the 1992.
2. BUTIL is not very friendly with some files, and I'm currently researching a problem I have trying to flatten a 109-mb Btrieve file.
3. You MUST use the old 8.3 file naming convention, at least with the version of BUTIL that I have. Your BUTIL output file will cause a funky error message if you make it longer than 8 characters or if you use more than 3 characters in your extension name.

Any of you Tek-Tips experts might tell me where I'm all wet on this, since I have had to make all this up as I go along.

If there's a straightforward routine out there that makes flat files, I would be more than happy to consider an immediate purchase.

For you, AMOSMP, I hope this helps.

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