Convert dBASE files to FoxPro files
This article was previously published under Q113942
This article has been archived. It is offered "as is" and will no longer be updated.
The information below explains how to convert dBASE files into FoxProfiles.
In FoxPro 2.x for Windows, this information is also found in the "Switchingfrom dBASE" topic in FoxPro version 2.6 Help. To go directly to this topicin FoxPro, choose dBASE Help from the Help menu.
FoxPro version 2.6 has new tools, as well as new and enhanced commands andfunctions, to maximize dBASE compatibility.
The Catalog Manager and AutoMigrate technology make converting dBASE filesto FoxPro easy. The Catalog Manager activates AutoMigrate and allows you toopen and manipulate existing dBASE catalogs and files. AutoMigrate worksbehind the scenes to automatically convert your dBASE files for immediateuse in FoxPro by modifying dBASE tables and creating new FoxPro screens,reports, labels, and queries based on the format of existing dBASE files.Conversion takes no effort on your part and does not prevent you from usingthe files again in dBASE.
Except for tables with memo fields, all your original dBASE files remainintact when they are converted for use in FoxPro. If your table has anindex, AutoMigrate rebuilds it.
In FoxPro for Windows, AutoMigrate also automatically transports files fromMS-DOS to Windows. For more information on transporting, see TransportingFiles. dBASE queries and programs run without conversion. They areautomatically recompiled in FoxPro.
NOTE: Compiled dBASE programs (.QBO, .FMO, .FRO, .LBO, and .DBO files)cannot be run in FoxPro unless the source code (.PRG) or design file (.QBE,.SCR, .FRG, .LBL) is available.
Converting Individual dBASE files to FoxPro:
AutoMigrate automatically converts dBASE files when you:
- Use a table with existing indexes or a memo field.
- Use or choose to modify a query.
- Run or modify a screen.
- Run or modify a report.
- Run or modify a label.
Tables(Databases) AutoMigrate converts dBASE tables when you use them. See Converting Tables for details.Queries AutoMigrate converts dBASE queries when you modify them. See Converting Queries for details.Screens (Forms) AutoMigrate converts dBASE forms to FoxPro screens when you modify or run them. Information about objects, fields, and so on is contained in a design file in dBASE. FoxPro copies the information in the dBASE file to a FoxPro .SCX file. Because of differences between MS-DOS and Windows, the appearance of your converted screens may need to be adjusted a little bit.Reportsand Labels AutoMigrate converts dBASE reports and labels when you modify or print them. See Converting Reports and Labels for details.Programs In most cases, no changes need to be made to dBASE programs. They are recompiled in FoxPro when you run them. See Converting Programs and Applications for details.
Converting TablesdBASE tables that have memo fields and/or indexes are converted when youuse them.
If your table is encrypted, you'll need to decrypt it in dBASE beforeconversion can take place.
FoxPro uses a different indexing algorithm than dBASE, so if the tablebeing converted has an associated dBASE .MDX or .NDX index, FoxProautomatically creates a FoxPro .CDX or .IDX index for the table.
To use a dBASE IV table with an index and without a memo field in dBASEafter FoxPro has converted it, open the file in dBASE and reindex. Thisstep is necessary only if you have changed any of the data.
Tables with Memo Files:
If a dBASE table has one or more memo fields, FoxPro automatically convertsthe memo file so that it is compatible with FoxPro. You can use a dBASE IIItable or a dBASE IV table with a memo field in dBASE after it has beenconverted into FoxPro.
To use a dBASE table after it has been converted to a FoxPro format:
- From the Data menu, choose Export... to open the Export dialog.
- In the Export dialog, choose dBASE III/IV with Memo from the File Type popup.
- Choose the Save As... button to enter a new name for the table.
- Choose Export.
Converting Reports and LabelsWhen FoxPro converts reports and labels, FoxPro creates an .FRX file withthe information from the dBASE .FRM file, and a .LBX file with theinformation from the dBASE .LBL file.
What FoxPro Converts:
FoxPro converts all bands, fields, calculated fields, hidden fields,picture templates, and functions for fields. FoxPro also converts styleattributes such as underline, bold, italic, and colors. Fonts are notconverted.
Word-wrap bands are converted to a series of one-line text fields in FoxProreports. Band spacing and pitch information is not converted. FoxPro doesnot use a global ruler or a word-wrap paragraph ruler, so this informationis not retained. Converted reports will have a right margin equal to thewidth of the report. The left margin is not changed but can be set in theFoxPro Report Writer
Reports with tab characters may need to have their fields rearranged toachieve the desired appearance.
Differences After Conversion:
Since empty report bands print in dBASE, FoxPro adds null characters tothese bands so they will also print in FoxPro.
dBASE reports do not store complete environment information, only databasealiases. As a result, upon opening a converted report, you might get anerror such as "Customer.dbf not found." FoxPro reports can save databasenames, relations, skips, and index information. Once in the Report Writer,set up the environment the way you want it and then save that informationwith that report. No more such errors will appear.
Troubleshooting Hard-coded Reports:
If the report is hard-coded, rather than created through the dBASE ReportDesign Tool, you'll want to keep in mind the following points:
- Interspersing ??? printer direct control commands with @ ... SAY commands can cause a problem with the output.
- If the report uses @ PROW() SAY commands to direct output to the printer, EJECT can cause the printer to feed a new page before all the @ ... SAY fields have been sent to the printer. You can avoid this by replacing EJECT with @ 0,0 SAY "".
- Make sure the command SET PRINTER TO is included at the end of the printing loop to force the output to the printer.
Converting QueriesFoxPro allows you to work with three types of queries: SQL queries,Updatable queries (.FPQ), and, in the Professional Edition, Client-Serverqueries (.CSQ). When you modify a dBASE .QBE query in the Updatable QueryWizard, FoxPro creates an .FPQ file.
If you add an aggregate function, such as SUM() or AVG() to a dBASE queryor an .FPQ query, FoxPro creates an equivalent .QPR file, using SQL tohandle the more complex query.
Converting Programs and ApplicationsIn general, dBASE IV programs and applications run unchanged inFoxPro. When you choose to run a dBASE program, FoxPro recompiles the.PRG file into an .FXP file and runs the .FXP.
Because of the differences in SQL implementation, dBASE IV .PRSprograms cannot be run in FoxPro.
If a dBASE program produces a runtime error or unexpected results, you candebug the program using the FoxPro debugging tools, Trace and Debug.
The Trace window allows you to step through your code a line at a time. TheDebug window has two panels. You can enter variables or FoxPro functions inthe left panel. The right panel displays the runtime values assigned to thevariables or returned by the functions. For more information aboutdebugging in FoxPro, see the "Program Menu" chapter of the FoxPro "User'sGuide" and the "Debugging Your Application" chapter of the FoxPro"Developer's Guide."
If a syntax error occurs when you are running a program, FoxPro highlightsthe error line in an editing window. You can use the Help file to check theproper syntax and usage for the command or function that caused the error.
- Make sure that the program does not include one of the six unsupported commands and functions listed in Unsupported dBASE IV Commands and Functions.
- Make sure that the dBASE program does not have a procedure, function, variable, or an array named with any of the FoxPro reserved words.
VFoxWin FoxDos FoxWin foxhelp.dbf foxhelp.hlp akz
Article ID: 113942 - Last Review: 12/04/2015 10:07:26 - Revision: 3.1
Microsoft Visual FoxPro 3.0 Standard Edition, Microsoft FoxPro 2.6 Standard Edition, Microsoft FoxPro 2.6 for MS-DOS
- kbnosurvey kbarchive kb3rdparty KB113942