Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do i Convert Cobol Data base files to Foxbase 1

Status
Not open for further replies.

Ozamj

IS-IT--Management
Jan 16, 2001
1
IN
Sir,

I want to convert my cobol data base files to foxbase DBF please give some tips for the same

Thanking You,

Ozamj
 
Hi,

First you should know how a header in a DBF is build. It starts with 32 bytes of information which contains the amount of fields, etc. Then for each field there is also a header of 32 bytes. Afther that there is a record with a delete marker, without a carriage return. In the old Dbase books, the format is perfectly explained.

If you have a binairy editor, you can just take the header off and put it apart. You can write in COBOL your records with an extra byte in front, without the carriage-return linefeeds. With the copy /b command, you can put your COBOL output and the header together. Example:

COPY /B HEADER + MYOUTPUT MYDBASE.DBF

An other option is to write the fields out of your COBOL environment into a comma delimited file. Than you read it into Excel which can save as DBF.

You can also import the text file into your FoxBase environment by a command something like APPEND FROM
but I am afraid that I am not a DBF guy. I have a Realia program that converts DBF files into a sequential text file.

You can mail me if you need such a program. But it is not for free... :) That was a few days work!

I have also something that converts DBF headers into a working-storage definition.

There is a great CD from Dr. Dobbs Journal with file formats, which explains also all about the DBF stuff.

I hope this helps.
 
I have a COBOL program written for Realia (imagine that!) with a MF version that demonstrates how to create a DBF file -- but not the reverse!

Anyway, If you want to do the conversion and you can program in COBOL it's not too hard. If you don't have the COBOL source and just want to convert the file - it's a virtually impossible task -- you cannot determine the file layout.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top