Kbase P74179: How to automate the import of a dBASE file
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  18/11/2008 |
|
Status: Verified
GOAL:
How to automate the import of a dBASE file
GOAL:
How to automate the import of a .dbf file
GOAL:
How do I import a .dbf file in batch mode?
GOAL:
How do I import a dBASE file in batch mode?
FACT(s) (Environment):
Progress 9.x
OpenEdge 10.x
All Supported Operating Systems
FIX:
Run mbpro db-name -p (multi-user batch) or bpro db-name -p (single-user batch) and specify the following .p file:
****************File starts after this line *****************
/* You must have unpacked the source from src/adecomm.pl and src/prodict.pl and add the unpacked directories to your PROPATH so prodict/dictvar.i and prodict/user/uservar.i can be found.
Assign the proper values in load-dbf.p to:
user_env[1] = "file name"
user_env[6] = "file name"
user_env[3] = "1"
user_env[4] = "dbf file name"
user_dbname = "database name".
If running from the command line and compiling this procedure on the fly you must have a starting procedure which will connect to your database, set the PROPATH to include the source directories and then run this procedure. The example below assumes that the source directories have been unpacked to C:\progress\src\
CONNECT <db name> -1.
ASSIGN PROPATH = PROPATH + ",c:\progress\src\".
RUN load-dbf.p.
Below is an example of load-dbf.p
*/
/* The includes set up the shared variables as new before calling the product procedures */
{ prodict/dictvar.i NEW }
{ prodict/user/uservar.i NEW }
/* You need to assign the proper names. "1" means that all fields are being used */
ASSIGN user_env[1] = "Test"
user_env[6] = "Test"
user_env[3] = "1"
user_env[4] = "file-name.dbf"
user_dbname = "dbase".
/* This is the procedure which will do the actual work */
RUN prodict/DUMP/_loddbff.p.
**********************File ends here*************************
If you want to load multiple files, just add another assign statement with the proper values for the user_env variables and run the prodict/dump/_loddbff.p again.