Foxhound is the better* Database Monitor for SQL Anywhere.
*better: More thorough, more relevant, more effective.
...more Alerts, more All Clears, more details, more control in your hands.

Breck Carter
Last modified: September 3, 1996
mail to:

Importing Text Files

How do I import a fixed-format text file into a DataWindow? The ImportFile() function only handles tab-delimited and dBase file formats.

You can call retrieve() to read a text file directly into a DataWindow by defining it as a "text database" to an ODBC text driver. This will let you define the widths and data types of each column in a fixed-format record. Here's an example of a file with 3 columns:

   00100Smith Enterprises               0010000.00
   00200Alpha Inc.                      0500000.00

The first step is to install the Intersolv ODBC text driver (called PBTXT07.DLL) by using the PowerBuilder 5 CD setup program.

Now you can define your text file by using the Database painter and selecting File - Configure ODBC. Pick "PB Intersolv 2.11 TextFile (*.*)", press "Create" and fill in the fields to look something like this:

Now press "Define", choose the text file name (it must already exist), press "OK" and fill in the field definitions:

This will create a separate file called QTEXT.INI in the same directory as your text file:

   [Defined Tables]


Now you can open that text file in PowerBuilder and paint a DataWindow based on the layout you've defined:

To read more about text file databases, search the PowerBuilder 5 Help on "Text driver" and then pick "Text driver". This will jump to the separate Help file called \pwrs\pb5\sys\pbdrv050.hlp that describes what you can and cannot do with text files via SQL.

Breck Carter can be reached by phone at (416) 763-5200 or via email at