Board index » delphi » Text files as databasefiles

Text files as databasefiles

Hi all,

We have to convert a delimited textfile into a dabase file
(preferable throuhg ODBC to an AS/400 machine). We tried to write a
small application in Delphi 2/3 in which we used two Table components
and a Batchmove.

Below is a sample of the textfile (table.txt) we had to convert:

3244,3255,6,48.8
3244,3256,12,95.5
3244,3257,18,146.6
3244,4301,28,246.6
3244,4302,31,262.2
3244,4305,23,215.5
3244,4306,19,186.6

For the BDE to be able to understand all this, it needs a .SCH file.
We tried the following:

[TABLE]
FILETYPE = VARYING
CHARSET = ascii
DELIMITER = "
SEPARATOR = ,
Field1 = ZipVan,LONGINT,04,00,00
Field2 = ZipTot,LONGINT,04,00,00
Field3 = Min,LONGINT,04,00,00
Field4 = Km,FLOAT,05,02,00

We have the following problem. When trying to Open the Table which is
connected to the Textfile we are getting the message "File name
incorrect". Does anybody know what the problem is ?

We know we have the correct file-extensions. The .SCH file is similar
to the one in the book "Delphi 2 Developers Guide" (which by the way
worls correctly). We even tried to rename table.* to something like
test.* (you never know if Delphi has trouble with the name 'table').

The BDE is configured correctly. When defining the
DatabaseName-property with the correct alias, the table-property is
able to find the correct file; it shows up in the dropdown-list.

We ended up by having MS-Access read in the textfile and moving the
data from Access to the AS/400-machine. But we still would like to
know what went wrong.

TIA,
    Mark

 

Re:Text files as databasefiles


In article <VA.0000006a.0089f14f@medwerker>, Mark Smits
<mpcsm...@pi.net> writes

Quote
>Hi all,

>We have to convert a delimited textfile into a dabase file
>(preferable throuhg ODBC to an AS/400 machine). We tried to write a
>small application in Delphi 2/3 in which we used two Table components
>and a Batchmove.

>Below is a sample of the textfile (table.txt) we had to convert:

snip..

Hi Mark,
        I had this problem when I tried to connect to a text file which
was located on a Netware server. I resolved it (eventually!) by using
the MS NetworkPath in the database alias. It includes the server name,
volume name and directory.

\\SERVER1\SYS\DATADIR\TABLENAME.TXT

I hope this helps. I don't know diddly about AS400's I'm afraid..

Cheers.

--
zizzin

Re:Text files as databasefiles


Mark Smits <mpcsm...@pi.net> wrote in article
<VA.0000006a.0089f14f@medwerker>...

Quote
> Hi all,

> We have to convert a delimited textfile into a dabase file
> (preferable throuhg ODBC to an AS/400 machine). We tried to write a
> small application in Delphi 2/3 in which we used two Table components
> and a Batchmove.

> Below is a sample of the textfile (table.txt) we had to convert:

> 3244,3255,6,48.8
> 3244,3256,12,95.5
> 3244,3257,18,146.6
> 3244,4301,28,246.6
> 3244,4302,31,262.2
> 3244,4305,23,215.5
> 3244,4306,19,186.6

> For the BDE to be able to understand all this, it needs a .SCH file.
> We tried the following:

> [TABLE]
> FILETYPE = VARYING
> CHARSET = ascii
> DELIMITER = "
> SEPARATOR = ,
> Field1 = ZipVan,LONGINT,04,00,00
> Field2 = ZipTot,LONGINT,04,00,00
> Field3 = Min,LONGINT,04,00,00
> Field4 = Km,FLOAT,05,02,00

<snip>

Hi,

I'm not sure if this will help, but here goes.
In the sch file where you've got [TABLE] this needs
to be the name of the ".txt" and the ".sch" file without
the extension.

Also, If you wanted to view the text file then you still have
to use the positional value in the sch file.
(  ie: Field2=ZipTot,LONGINT,04,00,05 <----This one  ).
Even with filetype=varying.

I pulled my hair out on this one when I wrote a utility to
go from text to database or database to text.

Good Luck
Bob Findley
------------------------------------------------------------------
The new rules of the devlopment process:
Alpha Testing:   A Clean Compile.
Beta Testing:    Put it in Production.
------------------------------------------------------------------

Other Threads