dBASE III PLUS and dBASE IV compatiblity

 

III+ PRG's are in THEORY are upward compatible to dBASE IV. Depending upon the exact previous version of dBASE, there are few commands that are no
longer compatible in dBASE IV.

dBASE III used numbers for SET COLOR TO. dBASE IV expect letters.

In dBASE III and III+, you could place comments at the end of such commands
as, ENDIF and ENDDO. So, an IF structure might look like:

IF <condition> 
... code ... 
ENDIF comment 

dBASE IV doesn't allow the comment unless it's preceded with &&.
SO, in dBASE IV the ENDIF needs to look like:

ENDIF && comment 

This error shouldn't stop your program from executing, but will trigger a compiler warining. To adjust your code for this condition go into the program editor, and use the search and replace function (<Alt>G, R) and search for "ENDIF", replacing it with "ENDIF &&" all the way through the program, and do the same for ENDDO, and you might check for other spots where that pops up. These are the only 2 commands that come to mind. There may be others, but they are few and far between.

Other than a command that is no longer supported the main problems going from III+ to IV code are - Incorrect syntax. In some cases III+ will allow you to run your program with incorrect syntax (missing ENDDO for example). III+ interprets each command as it execute it (which is much slower, but also much more forgiving). For example the following works in dBASE III PLUS,

DO WHILE .T. 
DO WHILE .T. 
WAIT 
ENDDO 
*missing ENDDO 

dBASE IV pseudo-compiles your programs, and does a fairly complete error check, where III+ did not. This means that if there are some spots in these programs where there were syntax error, or such, III+ may not have found them. dBASE IV checks every line of code for errors and will produce compiler errors as a result. dBASE IV will tell you where and what your problem is, so that it can be fixed.

The other thing to keep in mind is that as a general rule you don't want to name your files, fields or memory variables with dBASE reserve words, this means dBASE command names. For example

USE use

is a bad idea. This may work for you but sooner or later this will probably cause you a problem. Well now IV has a couple of hundred new commands. Maybe you have a memory variable called window. This is a dBASE IV command.
Again not always a problem but can be. These names will need to be changed to a non reserved word to avoid potential problems.

Along these lines make sure you follow the III PLUS naming conventions for fields, field names and memory variables, which is:

Begins with a letter, and contains letters,numbers and the underscore character.

Any III+ database will be directly read by dBASE IV with no changes necessary. However realize that a dBASE IV database file may have to be converted in order to use it back in dBASE III+.

A dBASE IV dbf is compatible with dBASE III+ if:

  1. You don't have any memo fields
  2. You have <=128 fields (III+ = 128 fields max, IV = 255 max)
  3. You do not declare you numeric fields to be of Type FLOAT in the structure. Interesting enough the numeric type in III+ is really FLOAT but is listed as NUMERIC in the structure. III+ will not recognize the word FLOAT and will convert these fields to type LOGICAL should you try to use it. Your NUMERIC fields will come into III+ OK from IV but in some cases you files will act differently because it is now treated as a floating point number. (The data is the same but some commands, particularly ones that round a number can give you different results with dBASE III+ NUMERIC (dBASE IV FLOAT) as opposed to fixed (dBASE IV NUMERIC).

If ANY of the above apply make sure you have <=128 fields and

USE <filename> 
COPY TO <filename> TYPE DBMEMO3 
* TYPE DBMEMO3 - convert a dBASE IV DBF to a III PLUS DBF. 

If your database has no memos, no type float and <= 128 fields it should then be readable in either version without using TYPE DBMEMO3.

NOTE: TYPE DBMEMO3 will run with a DBF > 128 fields, but will not correct the fact that you have > 128 fields. After running this command you will get errors trying to open the DBF in III PLUS. You must manually split the DBF in to more than one file and use a keyfield or record number to combine the databases with a RELATION if you want to work with more than 128 fields in III PLUS. See SET RELATION in Language Reference for more details.

USE big 
SET FIELDS TO key_fld, fld_1, fld_2... 
COPY TO split_1 
SET FIELDS TO key_fld, fld_3, fld_4... 
COPY TO split_2 

Also see:

TI 1454 DBASE IV [DOS]: Will your dBASE III PLUS programs work in dBASE IV without a hitch? (4 Pages)

TI's can be obtained from out download machine at 408-431-5096 (8,N,1).
Compuserve Lib 10: TI1454.ZIP
Or our automated fax service at 800-822-4269.
World Wide Web:
http://www.inprise.com/devsupport/VdBASE/ti_list/


[Home] [FAQ Index]