?
Solved

Can I create a .dbf file for db2 (AS400) ?

Posted on 2002-04-12
9
Medium Priority
?
1,077 Views
Last Modified: 2008-03-06
I don't know a single thing about db2/as400.  I have someone that wants me to create a .dbf file that can be imported into their database.  Can this be done?  For me to accept the answer, I need an explanation of a .dbf file and how db2 uses it.  I also need to know if its just a matter of writing to a file with extension .dbf from VB.  Thanks.
0
Comment
Question by:jackjeckyl
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 6937085
dbf files are the dBase format (remember that products). It is a proprietary format.

Prefer using another format (a csv file for example - whihc is nothing more than an ASCII file with fields separated with commas).

You can also connect to the AS/400 computer and fill the database from VB. See:
http://www.able-consulting.com/ADO_Conn.htm#ODBCDriverForAS400 
http://www.able-consulting.com/ADO_Conn.htm#OLEDBProviderForAS400FromIBM
0
 

Author Comment

by:jackjeckyl
ID: 6937147
I won't be connecting to the database, all I'm going to do is create a file for him.  Thus, he is going to give me specs and I will create a file from that.  So I can just write a file with a .dbf extension same as I would with a .txt?
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 6937166
NO! dbf is a propietary format (the format used by dBase).

Suggest another format like a .csv file.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:jackjeckyl
ID: 6937192
OK, so VB CANNOT create a .dbf file?  or shouldn't?  I don't think the guy knows exactly what he wants.  I suggested a delimited type file, but he didn't seem too sure.  He insisted on a .dbf file, and I told him I would look into it.  No go?
0
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 150 total points
ID: 6937198
Have a look at
http://www.winsite.com/bin/Info?500000003589


I have also found this:



  ' Export Table from MDB-File into
  ' DBF-File-Format
  ' for dBase/Clipper
 
  Dim mdb_Table As String
  Dim dbf_Table As String
  Dim sql_statement As String
  Dim path_target As String
  Dim dbf_target As String
 
  ' declare Database-Object
  Dim MyDB As Database
 
  ' Source MDB-File
  mdb_Table = "C:\allpst\allpstneu.mdb"
 
  ' Table in MDB-File
  dbf_Table = "plan"

  ' Target-directory
  path_target = "C:\test"
 
  ' Target-DBF-File
  dbf_target = "newdbf"
 
  ' SQL-Statement
  sql_statement = "SELECT * INTO [dBase IV;database=" & path_target & "]." & dbf_target & " FROM " & dbf_Table
  'sql_statement = "SELECT * INTO [dBase IV;database=C:\test].newdbf FROM person"
     
  ' open the MDB-Database
  Set MyDB = DBEngine.OpenDatabase(mdb_Table)
 
  ' delete DBF-File before "copying"
  If UCase(Dir(path_target & "\" & dbf_target & ".dbf")) = UCase(dbf_target & ".dbf") Then
    Kill path_target & "\" & dbf_target & ".dbf"
  End If
 
  ' SQL-Statement and transfering data
  MyDB.Execute sql_statement
 
  ' close MDB
  MyDB.Close
 
  Set MyDB = Nothing
0
 

Author Comment

by:jackjeckyl
ID: 6937351
So if I wanted to write data to db2, I'd have to do it as a big insert statement.  I haven't seen anything that says to write to a .dbf file, do this.  Just the Access export to a .dbf.
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 6937366

This statement:
'sql_statement = "SELECT * INTO [dBase IV;database=C:\test].newdbf FROM person"

takes data from a "person" table stock anywhere and create a DBF file name "newdbf" into the "c:\test" folder. Isn't it what you are looking for?
0
 

Author Comment

by:jackjeckyl
ID: 6937399
I think I'm good.  Thanks for the help.
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 6937426
will you be back soon to close the question?
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question