Link to home
Start Free TrialLog in
Avatar of docfxit
docfxit

asked on

Convert DBF to a flat file

I have a .dbf file that I think came from DB III.  I need to convert it to
a flat file.  I am able to bring it into Paradox 7 but I can't figure out how to save it into a flat file.  I know Paradox can do it because someone else did it with this file.  The saveas is grayed out.  The export only allows DB or DBF files.  I also have MS Office 97.  Access doesn't want to read this file.  Excel will read the file but changes the field widths when it brings it in.  I also have Lotus and Quatropro 8 available to me.  If necessary I might be able to get FoxPro.

Thanks,
Gary Kuznitz
Avatar of david_levine
david_levine

What's the issue with opening it in Excel? It should open the file and allow you to manipulate it. You should be able to save it in a bunch of different flat file formats. What's the specific issue?

David
Avatar of docfxit

ASKER

Hi David,

When I bring it into Excel 97 it looks like the field widths change. I don't know how to make the fields on the screen show the correct width.   I tried saving the file into a text file with a .prn extension and the fields on the right were cut off.  I'm guessing probably around 133char.  The fields were lined up.  I tried saving the file into a text file with txt and the fields weren't lined up.  Both times I tried reading the file with a fixed pitch font.  Those are the only two types of text files it allows me to save it in.

Do you know of a better way?

Thanks for your help,

Gary
Really long columns might not show everything... but first try this...

1) Highlight the column with the long data (eg. "E")

2) Click the Format menu and click the Cells... menu item

3) Click on the Alignment tab

4) Check the Wrap Text box and set the Vertical drop-down value to Top

5) Click the Ok button

Does that show you all/more of the text?

To save the file, I'd suggest using a tab-delimited file since all programs can understand that format. The only issue would be if you have embedded tabs in your data. To save in tab-delimited format:

1) Click File... Save As...

2) In the Save as Type drop-down, selected Text (Tab delimited)

Your records won't be fixed length, but they will be tab delimited. You didn't mention what you want to do with the file after this.

David
Gary,

How difficult is it to get a copy of dBase3 somewhere? Using
this it's easy to create a comma seperated file.... or something other. This file must be easy imported into a database.

(I did it myself with a dBase3 file to a Sybase database, had
some problems with non-ascii signs like ë but managed to do it).

Arjan
Avatar of docfxit

ASKER

I don't require a copy of Dbase III.  I do need a flat file.  I'm am trying to get this file of 3500 records into an AS/400.  The ASCII file translator to EBCDIC requires a flat file.  I have the DDS all set up on the AS/400 ready to read a flat file.  Example:
Employee in CC 1-8
First name in CC 9-34
Last name in CC 35-60  etc......

When I try MS Excel the fields are not aligned up.  I don't know if it's because I don't have a proper fix for Excel or if that's just what Excel does.  There has to be a program someplace that will write out a flat file.  Probably some freeware.  I just can't find it.  I do have Paradox and I know it wrote it out before.  I know someone else that used it to convert this same file to a flat file.  I just can't figure out which option was taken to write out a flat file.

Thanks,

Gary
The simple method if you have dBase or FoxPro to hand is :

Use <FileName>
Copy To <FlatFile> TYPE SDF
Use

But that doesn't really help you if you only have paradox.
Avatar of docfxit

ASKER

Hi all,

I found a freeware program that makes a flat file out of a tab delimited file at:
http://www.execpc.com/~pbhall/index.html?http://www.execpc.com/~pbhall/download.html

It's the first one on the list called Flatulate.  In order for the flat file to come out correctly I had to change the Excel spreadsheet whenever there was a date.  It had as an example:

10/23/89
1/15/76

So they didn't line up.  I changed all of the columns to:
mmddyyyy
I don't know if there is a default/automatic way to do that.  

I'm still having problems with one column.  It's a numeric column with as an example:

..00
2.00
..50

I can't get the fields to zero fill like

00000.00
00002.00
00000.50

So when it gets saved as a tab delimited file the fields will line up correctly.  I have tried putting a mask on it like:
0####.##

But it won't change the 3523 fields that are already typed in.  It's currently set up as a numeric, right aligned field.  I'm using Excel '97.

Thanks for any words of wisdom you might have.

Gary
00000.00 as an edit mask for the numeric fields should work. Just use as many 0's on the left of the decimal to cover whatever the maximum value could be.

David
Avatar of docfxit

ASKER

Putting in an edit mask of 00000.00 works great for a cell that you type in.  Now how can I apply that edit mask to all 3523 cells in the column?

Maybe I am applying the edit mask wrong.  The way I am doing it is right clicking on the header of the column.  I choose format  and select General instead of numeric.  I type in the edit mask of 00000.00 and click ok.  Now if I change a value, the edit mask kicks in.  But I can't get the previously keyed in values to change automatically.  I didn't want to re-key all 3523 values.

Maybe I just need a lesson in how to use Excel.

Thanks,

Gary
Click on the column header and it will highlight all the rows in that column. As an example, "C" is the column header for the 3rd column in a sheet. Once the column is highlighted (selected), right mouse click over it, and select Format Cells... from the pop-up menu. Just like you are formatting a single cell, you will format the entire range. So, select the Number tab, then click on Custom in the list and type in 000000.00 and that edit mask will be applied.

David
Avatar of docfxit

ASKER

Ok.
Now that you have asked me to do exactly what I have done already maybe it's time you tried to format a column with numeric and key in a few cells.  Then save the sheet.  Bring up the sheet and follow your instructions.  If you see every cell change then there must be some option in Excel that you have different than I do.  If you don't see all other cells change then you see what my problem is.

Gary
I'm not sure what you are saying... but if I click on the column header and format the cells for that column, all the numbers currently in the column change to match the format, as well as any new numbers I add to additional cells in the column.

Sorry if it isn't working for you, but I'm not sure what the problem on your end is.

David

Maybe you should post this specific portion of your question in the Office-Word-Excel section at https://www.experts-exchange.com/Computers/Applications/MS_Office/

David
If you have MS Access 97 (or above) you can link DBF table(s) into MS Access database and use Save As/Export command to write data to flat file.

MS Access lets you choose if you want to save flat file comma delimited or fixed width fields. If you choose the fixed width you can define field lengths and starting positions quite easily.

Arto
Avatar of docfxit

ASKER

Got it all working.  Thanks for your help.  I don't know how the points are allocated to each person.  Some answers were exactly what I needed.  Thanks again.

Gary
Avatar of docfxit

ASKER

How do I close out this question?
ASKER CERTIFIED SOLUTION
Avatar of Ron Warshawsky
Ron Warshawsky

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
or contact EE support service and ask them to split points...
Avatar of docfxit

ASKER

Thanks a bunch