Solved

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

Posted on 2002-04-12
9
1,010 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
  • 5
  • 4
9 Comments
 
LVL 69

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 69

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
 

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 69

Accepted Solution

by:
Éric Moreau earned 50 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 69

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 69

Expert Comment

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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

914 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now