Kbase 30: How To Convert dBase II and dBase III Files to Progress Files
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  16/10/2008 |
|
Status: Unverified
GOAL:
How to convert dBase II and dBase III files to Progress files.
GOAL:
Workaround for an error message that dbf.err cannot be found or opened.
FACT(s) (Environment):
Progress 6.x
Progress 7.x
FIX:
Only dBase II and III files can be converted. A dBase III Plus file can be converted to a regular dBase III or dBase II file using option 7 in the Ashton-Tate supplied "dconvert" utility, which can be converted to Progress with the dbf utility.
The list of internals of the data conversion program (ddf.exe,
accessed through the Data Dictionary) is as follows:
It requires the following arguments:
dbf dbfmode nuximode dbffile [ndxfile] errorfile > outfile
[ ] means this is optional.
- dbfmode:
This mode can be 1, 2, or 3.
- 1 means data is produced. The dbffile should be the
.dbf file. It produces the .d files of Progress.
- 2 means definitions are produced. The dbffile should
be the .dbf file. It produces the .df files of
Progress.
- 3 means index data definitions are produced. The
optional ndxfile should be used. It produces a .df
file for Progress.
- nuximode:
This mode should be 0. This means that the conversion takes
place on the same machine (for example, DOS to DOS).
- dbffile:
This is the dBase file to be converted. There are two types
of dBase files:
.dbf:
The .dbf file contains both the data definitions
and the data to be converted into two Progress
files, the .df and the .d respectively.
.ndx:
The .ndx file is the index of the .dbf file. It
also is converted into a .df file. You should only
supply this file name when the dbfmode is 3.
- ndxfile:
This is an optional ndxfile name that you want to convert
into Progress readable format.
- errorfile:
This file catches all errors (if there are any).
- >:
This is a pipe to redirect the result into a file. If you
leave this out, all output goes to the screen.
- outfile:
This is the Progress file that is to contain the result.
There are two types of Progress Files, .df and .d files.
It is important to note that since dBase does not have a .db file, every dBase application probably uses more than one .dbf file for data. In order to successfully convert the data to Progress, you must be aware that you are loading more than one data definition (that is, one .df file for every .dbf and .ndx file that exists).
For example:
Dbase
customer.dbf the customer data
custname.ndx index on customer name
order.dbf the order data for all customers
ordnum.ndx index on order number
custord.ndx index on customer name and order
number
The resultant OS command lines to convert dbf file to
Progress readable format:
dbf 1 0 customer.dbf bd.err > customer.d
dbf 2 0 customer.dbf db.err > customer.df
dbf 3 0 customer.dbf custname.ndx db.err > custname.df
dbf 1 0 order.dbf db.err > order.d
dbf 2 0 order.dbf db.err > order.df
dbf 3 0 order.dbf ordnum.ndx db.err > ordnum.df
dbf 3 0 order.dbf custord.ndx db.err > custord.df
NOTE: Remember that Progress can only convert dBase II
or dBase III files as stated earlier.
Sometimes you encounter the error message that dbf.err could not be found or opened (dbf.err logs all errors during the conversion process).
Solution:>
The reason dbf.err could not be opened is that there is not
enough available internal memory to run the conversion through
the Dictionary program. This can be alleviated by making sure no
RAM-resident programs are running or by adding more memory to the
system (640K maximum.)
Here is a 3-step workaround that enables you to import dBase III
data into Progress while you wait to get the extra memory:
1) Within dBase III use the copy command to copy the data to
a comma-delimited ASCII file:
COPY TO FILENAME.TXT SDF.
2) At the DOS level, use quoter to put the ASCII file into
Progress-readable format:
QUOTER -d , FILENAME>TXT > filename.d
("-d ," tells quoter that the file is delimited by
a comma.)
3) In Progress, set up a file with the same fields and exact
lengths of the dBase III file, then use the following
Progress procedure to import the data:
DEFINE VARIABLE cnt AS INTEGER LABEL "Number of records added...".
PAUSE 0 BEFORE-HIDE.
INPUT FROM filename.d NO-ECHO.
REPEAT:
CREATE filename.
SET filename.
ASSIGN cnt = cnt + 1.
DISPLAY cnt WITH FRAME num-rec SIDE-LABELS CENTERED ROW 10.
END.
NOTE: dBase III exports date fields as character in the format of year, month, day (12/28/86 becomes "19861228"). When you define a date field in Progress that is going to accept dBase III data, define it as a character format "x(8)" and later convert it to a real Progress date field..