Overview of dBASE Compatibility

ID: Q114273

2.60    | 2.60
WINDOWS | MS-DOS
 kbprg

The information in this article applies to:

SUMMARY

The information below describes FoxPro's dBASE compatibility. This information is also found in FoxPro version 2.6 Help.

To locate this help file topic, do one of the following:

MORE INFORMATION

                            DBASE COMPATIBILITY
                            ===================

Both dBASE III and dBASE IV files can be used in FoxPro.

Sharing Files Between dBASE and FoxPro

Although you can share files between dBASE and FoxPro, it is not recommended. FoxPro and dBASE have incompatible file locking mechanisms. In addition, because of the necessity of recreating index and memo field files for each application, tables are difficult to maintain.

dBASE III

FoxPro is a superset of dBASE III. Your dBASE III programs can run unchanged in FoxPro. See the discussion on FoxBASE+ compatibility for details.

dBASE IV

The only significant areas of incompatibility with dBASE IV are security, network functions, and the more rarely used SQL and transaction processing functions. Most SQL programs (.PRS files) will need to be rewritten in FoxPro. Also, FoxPro doesn't offer native support for security or transaction processing. Many software vendors offer extensive libraries of security and network functions, providing an even richer alternative to the set of functions supported in dBASE.

Enhancing Compatibility with dBASE IV

You can maximize compatibility by issuing the command:

   SET COMPATIBLE DB4

This command changes the way FoxPro executes certain commands and functions to match the behavior of dBASE. Setting COMPATIBLE DB4 is a great way to get your application up and running. Eventually, as you add FoxPro features, you might find it easier to move away from using the compatibility feature.

When you are operating in the Catalog Manager, SET COMPATIBLE DB4 is the default.

Template Programming

The dBASE IV template language is different from and independent of dBASE, so dBASE template programs cannot be used in FoxPro and will have to be rewritten. However, you don't have to learn another template language. FoxPro supports template programming natively. FoxPro commands that can be used in template programming include:

    \ | \\ 
    SET TEXTMERGE DELIMITERS
    SET TEXTMERGE
    _TEXT
    _PRETEXT
    TEXT ... ENDTEXT

For more information on template programming in FoxPro, see Chapter 11, "Text Merge," in the FoxPro "Developer's Guide."

Other Issues in dBASE IV Compatibility

In addition to the few language and syntax differences, the following differences between FoxPro and dBASE should be noted.

Parameter Passing:

In dBASE IV, parameters are passed by reference to both procedures and functions. In FoxPro, parameters are passed by reference to procedures and by value to functions.

To pass parameters by reference to functions, add the command SET UDFPARMS TO REFERENCE to your program.

Changing Work Areas in a UDF:

In FoxPro, if you change the selected work area in a UDF, the newly selected work area remains selected when the UDF returns control to the calling program. Upon return from a UDF, dBASE IV reselects the work area that had been selected before the function was called.

SET MULTILOCKS:

SET MULTILOCKS ON is implicit in dBASE IV. You must explicitly set multilocks on in FoxPro.

Reading Keystrokes:

dBASE IV and FoxPro use different keyboard shortcut keys in the interactive environment. If a dBASE IV application uses the READKEY or LASTKEY functions to check the user's last action and respond appropriately, errors might result.

FoxPro reads the key assignments from a macro file with the extension .FKY. Modify the FOXPLUS.FKY macro file included with FoxPro versuib 2.6 so keystrokes are mapped to dBASE keystrokes. Then issue the command RESTORE MACROS FROM FOXPLUS.FKY from your program.

Hard-Coded File Extensions:

If you have hard-coded file extensions in your dBASE programs, you'll need to change some of the extensions. The following table shows FoxPro equivalent extensions for each type of dBASE file that a program might use. This table assumes that AutoConvert has converted all associated dBASE files.

   dBASE File    FoxPro File
   ------------------------------

   .DBF          No change needed
   .DBT          .FPT
   .FMT          .FPX
   .FRG          No change needed
   .FRM          .FPX
   .LBG          No change needed
   .LBL          .FPX
   .MDX          .CDX
   .NDX          .IDX
   .PRG          No change needed
   .QBE          No change needed

Additional reference words: FoxDos FoxWin 2.60 foxhelp.dbf foxhelp.hlp KBCategory: kbprg KBSubcategory: FxinteropDbase
Keywords          : kb3rdparty FxinteropDbase 
Version           : 2.60 | 2.60
Platform          : MS-DOS WINDOWS

Last Reviewed: May 13, 1998