Impord dBase Data (*.dbf) to TempTable

Ragman

New Member
Hello together,

this is my first post and first of all, sorry for mistakes in writing, English is not my first Language (I come from Germany).

I´m new in Progress, working with it now for about 7 Month.
Before we start in Progress we worked with FoxPro 9.0 and many *.dbf Files and now we start moving them to our HP.
For some Statistik Programms it´s necessary to have Data in Progress form *.dbf Files, because it is not possible
to go in one Step with all our *.dbf Files to Progress.db.

My Problem is that i want to import *.dbf Files in a Procedure or Programm with no further tool,
i want to do it in Procedure and not with the "Data Administrator" because the *.dbf Data is not statik
and i need it just in time ...
A *csv import or something like that is also not what i want, because for that i first have to start FoxPro.

I have looked all around in this Forum but i couldnt find anythin,
so please help me :)

Many thanks for all answers.

With regards
Ragman
 
AFAIK you can't access a FoxPro database from within a 4GL procedure. The only ways I know that work is to either export the data from FoxPro or use Excel as an intermediate.

Heavy Regards, RealHeavyDude.
 
Hallo again,

i wonder for that, because Progress gives the Tool "Data Administrator" and
for my opinion it´s only a comfortable Way to do it ...
I mean there must be a way to write the same "by foot" in a syntax file ...

Nobody who has n idea who this may can work ??

Best regards
Ragman
 
One possible solution could be to use parts of a “Batch Convert FoxPro .dbf files” procedure outlined here:

http://progresscustomersupport-surve...rticle/20932/p

However, this is quite old as it mentions version 8.3B and also it is not easy to read at all due to the code not being formatted. But if you can use the workings that convert the .dbf files to .d files and these .d files are valid this could be the answer. You would then create your own procedure that has Temp Tables and import the data from the .d files into the Temp Tables.
 
Hello Osborne,

thx for your Posting, thats what i´m looking for.
But quit hard for me to get sense of this Link ... it looks like "spaghetti-code" ... :confused:

I will try to get it, if somebody could help and explain it for me or better could write a readable code for it
i would be very happy ...

Best Regards
Ragman
 
Yes, the code is a real mess because it is missing the returns/next line characters. Unless anyone knows of an easy way to adjust or has this exact procedure the only option is to copy and paste and add the returns yourself. So for example, the lines that appear:

/* **********************************************************************//* **********************************************************************//* ********************** Variable Definitions ***********************//* **********************************************************************//* cPropathDirList : Comma separated list of all PROPATH directories*//* cDirectoryName : Current directory's FULL-PATH name *//* iDirectoryCounter : Integer counter used directories loop *//* iDirectoryCounter : Total number of directories in the PROPATH *//* cfilename : Current directory file name *//* cConvertedFileName: Current converted .d file name *//* cDataBaseTableName: Current table name corresponding to the .d file *//* **********************************************************************/DEFINE VARIABLE cPropathDirList AS CHARACTER NO-UNDO.DEFINE VARIABLE cDirectoryName AS CHARACTER NO-UNDO.DEFINE VARIABLE iDirectoryCounter AS INTEGER NO-UNDO.DEFINE VARIABLE iDirectoryNumber AS INTEGER NO-UNDO.DEFINE VARIABLE cfilename AS CHARACTER NO-UNDO.DEFINE VARIABLE cConvertedFileName AS CHARACTER NO-UNDO.DEFINE VARIABLE cDataBaseTableName AS CHARACTER NO-UNDO./* **********************************************************************/

with the returns added becomes:

/* **********************************************************************/
/* **********************************************************************/
/* ********************** Variable Definitions ***********************/
/* **********************************************************************/
/* cPropathDirList : Comma separated list of all PROPATH directories*/
/* cDirectoryName : Current directory's FULL-PATH name */
/* iDirectoryCounter : Integer counter used directories loop */
/* iDirectoryCounter : Total number of directories in the PROPATH */
/* cfilename : Current directory file name */
/* cConvertedFileName: Current converted .d file name */
/* cDataBaseTableName: Current table name corresponding to the .d file */
/* **********************************************************************/
DEFINE VARIABLE cPropathDirList AS CHARACTER NO-UNDO.
DEFINE VARIABLE cDirectoryName AS CHARACTER NO-UNDO.
DEFINE VARIABLE iDirectoryCounter AS INTEGER NO-UNDO.
DEFINE VARIABLE iDirectoryNumber AS INTEGER NO-UNDO.
DEFINE VARIABLE cfilename AS CHARACTER NO-UNDO.
DEFINE VARIABLE cConvertedFileName AS CHARACTER NO-UNDO.
DEFINE VARIABLE cDataBaseTableName AS CHARACTER NO-UNDO.
/* **********************************************************************/
 
Hello togehter,

sorry for my late Posting, but i last week Thursday i had Birthday and vacation for that time, till yesterday ... ;)

I have tried to understand the code, for me it seams that there is a lot of double code in it.
For me it is not nessasarry to import about 5000 FoxPro-Files, i only want to import one or two files
in a TempTabel to work with that statik code there ...

I think if somebody could watch the code, there are for my opinion maybe only 5 or 6 rows code what i realy need,
but i don´t know what rows they are.
Could there be somebody so kind to look for these rows??

Thank you very much :eek:

Best Regards
Ragman
 
The part that does the actual converting of a .dbf file to a .d file is this part:
Code:
/* Assign the full path name of the dbf.exe conversion utility */
/* Construct the name of the current database table from .dbf file info*/
/* Construct the name of the current .d file from .dbf file info */
/* Construct the name of the current error file from .dbf file info */
/* Assign the value of Conversion and Bit Order format variables */
/* Run the dbf.exe utility passing it desired parameters and arguments */
/* Return the names of the .d file name and the table name */
/* **********************************************************************/
PROCEDURE ConvertAdbfFile:
   DEFINE INPUT PARAMETER cDBFFileName AS CHARACTER NO-UNDO.
   DEFINE OUTPUT PARAMETER cConvertedFileName AS CHARACTER NO-UNDO.
   DEFINE OUTPUT PARAMETER cDataBaseTableName AS CHARACTER NO-UNDO.

   DEFINE VARIABLE cExecutableCommand AS CHARACTER NO-UNDO.
   DEFINE VARIABLE cConversionMode AS CHARACTER NO-UNDO.
   DEFINE VARIABLE cBitOrderFormat AS CHARACTER NO-UNDO.
   DEFINE VARIABLE cCommandArguments AS CHARACTER NO-UNDO.
   DEFINE VARIABLE cDBFErrorFileName AS CHARACTER NO-UNDO.

   ASSIGN cExecutableCommand = SEARCH("dbf.exe")
          FILE-INFO:FILE-NAME = cDBFFileName
          cDataBaseTableName = SUBSTRING(cDBFFileName, 1, INDEX(cDBFFileName, ".dbf") - 1 )
          cDBFFileName = FILE-INFO:FULL-PATHNAME
          cConvertedFileName = SUBSTRING(cDBFFileName, 1, INDEX(cDBFFileName, ".dbf") ) + "d"
          cDBFErrorFileName = SUBSTRING(cDBFFileName, 1, INDEX(cDBFFileName, ".dbf") ) + "err"
          cConversionMode = "1"
          cBitOrderFormat = "1"
          cCommandArguments = cDBFFileName + CHR(32) + cDBFErrorFileName + CHR(62) + cConvertedFileName.
          OS-COMMAND SILENT VALUE(cExecutableCommand) VALUE(cConversionMode + CHR(32) + cBitOrderFormat + " " + cCommandArguments).
 END PROCEDURE.
When this is run it reads the .dbf file passed in cDBFFileName, reads this .dbf file and creates a .d file from the data and returns the name of the created .d file in cConvertedFileName. You would probably not need the cDataBaseTableName part so can remove all references to this.
 
Hi Osborne,

have many thanks for your help :)
I will try on Monday because i have ones more free (I will marry tomorrow ... :) and Friday i will have free too)

Have a nice weekend,

kind regards
Ragman
 
Hello together,

after my very nice wedding i start this morning with many confidence to solve my converting-Problem.
I try this first under commandline (CMD) on a small *.dbf file (56kb) with the following arguments:

"C:\Progress\OpenEdge\Bin>dbf 1 1 C:\temp\pnv.dbf C:\temp\test.err > C:\temp\test.d"

(Btw you can see all arguments of the dbf.exe when you start it with DOS-Command.)

First 1 means that a *.d File should produced, second 1 means the nuximode (i tried 0 and 1) but the result
was both time the same.
I get an empty *.d File and in the *.err File was a Message "C:\temp\pnv.dbf is not a dBase file" :-((

What is wrong with it ... ?
Is there someone who can help? ...please...

Best Regards
Ragman
 
Back
Top