Solved

Converting Dbase files to Text files

Posted on 1999-01-14
9
283 Views
Last Modified: 2008-03-10
Using MS Excel, I can open a Dbase file with .dbf extension
and save it as an text file (Internally the file gets converted). I am wordering if the same can be done at the command line (i.e at the DOS prompt with out opening and saving the file so, that I can put it in a batch file).
Or to Invoke the Excel's file conversion tool with out opening Excel.
In short I want to automat the process of conversion with out human intervension in a batch file
0
Comment
Question by:bujji120198
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
  • +1
9 Comments
 
LVL 17

Expert Comment

by:mikecr
ID: 1615685
To my knowledge, no, you won't be able to do that. What happens is Excel is using built in ODBC drivers which allow for conversion of database files into text format or a different database format for importation. These ODBC drivers are not active in Dos, only in Windows. Unless someone else would happen to know some way that you could convert it without using ODBC then you probably won't be able to do it.

Mike
0
 

Author Comment

by:bujji120198
ID: 1615686
Edited text of question
0
 
LVL 5

Expert Comment

by:vboukhar
ID: 1615687
Why want you use Excel for such purposes? There are many applications for dBase file operating under DOS. I used Clipper for it, and there is a sample below for solution for your problem (just compile it by Clipper and you'll get an .EXE file, that you can call from batch file). I can send it to you (.EXE) by e-mail (if you don't find Clipper and don't fear use self-made software)

param f1
if f1=NIL
   ?" There is no file name in command line"
   canc
endif
f1=trim(f1)
use &f1
newname=left(f1,at(".",f1)-1) + ".txt"
?"Write to file ",newname
copy to &newname delimited
close

As you see, there is only one string - "copy to .. delimited"
(resulted file contains values, delimited by commas. You can use "copy to ... sdf" for constant-width columns format)
0
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 

Author Comment

by:bujji120198
ID: 1615688
Mr. vboukhar,
        It would be great if you can send me an email of the executables for:
        1. For comma delimited and
        2. For constant-width columns format
 to the following email address: krmallina@hotmail.com

Thanks,
I really appreciate you help,
bujji.

0
 
LVL 5

Accepted Solution

by:
vboukhar earned 20 total points
ID: 1615689
I 've sent it.
By the way, you can do it in Excel, but without passing filenames to it (for example, for all files in directory etc.). Or even for some desireble list of files, but you have create this list in .txt file and read it from Excel.
Sample of converting of all files in current directory:
Sub dbf_to_txt()
  MyPath = ActiveWorkbook.Path & "\*.dbf"
  Fname = Dir(MyPath)
  While Len(Fname) <> 0
     NewName = Left(Fname, InStr(Fname, ".") - 1) & ".TXT"
     FullName = ActiveWorkbook.Path & "\" & Fname
     Workbooks.Open Fname
     ActiveWorkbook.SaveAs NewName, xlTextWindows
     ActiveWorkbook.Close False
     Fname = Dir()
  Wend
End Sub
0
 
LVL 1

Expert Comment

by:Astroman
ID: 2752374
Vboukhar,

Can you send me this executable also, I'd be very interested in using it.

leongierat"at"excite.com

Thanks a lot
0
 
LVL 5

Expert Comment

by:vboukhar
ID: 2757398
Astroman,
I met some hardware problem with my home PC so I have no ability to get to Clipper (I don't have it at my work computer). I hope I resolve my problem soon and then I'll send you that file.
0
 
LVL 1

Expert Comment

by:Astroman
ID: 2757415
Hi Vboukhar,

I don't need it nw. I wanted to convert the dbf to text because I thought excel was corrupting it. I've been into the file with a hex editor though and can see it's wrong inside :9

I leave this job on Friday anyway, so I don't need to concern myself with it anymore!

Thanks for you r help, and hope your computer recovers happily!

Leon
0
 
LVL 5

Expert Comment

by:vboukhar
ID: 2757442
By the way - if you are using hex editor - simplest way to repair dbf file is to remove its header at all and open it in Excel as file with constant-width columns format. I did it often some years ago :-)
0

Featured Post

Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Using Word 2013, I was experiencing some incredible lag when typing.  Here's what worked for me....
My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
This video walks the viewer through the process of creating Hyperlinks for the web and other documents. Select the "Insert" tab: Click "Hyperlink":  Type "http://" followed by a web address to reference a website or navigate to a document to ref…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …

687 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question