Append SDF error

Marc Vanzegbroeck
Posts: 1163
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium
Contact:

Append SDF error

Post by Marc Vanzegbroeck »

Hello,

I have a program that import some information from a text-file with the append from SDF command.
From time to time it doesn't import all records.
Here is the test-code:

Code: Select all | Expand

#INCLUDE "fivewin.CH"
REQUEST DBFCDX
FUNCTION test()
   local vstruct:={}
   RDDSETDEFAULT("DBFCDX")
   dbstructuur:={}
   aadd(vstruct,{'LINE','C',199,0})
   dbcreate('import.tmp',vstruct)
   use ('import.tmp') new
   appe from test.txt sdf
   go top
   browse()
RETURN nil
 


Here is the text-file that can't be imported completly. It allways stops at the same record, and I can't find out why.
http://www.vms.be/FWTest/test.txt
Can someone try this?
My last record is allways:
<Artikelcode>SCTATC</Artikelcode>

I use FW710.

Thanks,
Marc
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
User avatar
driessen
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Append SDF error

Post by driessen »

Marc,

To my opinion, your TEST.TXT-file is an XML-file.
I don't think you can add data to your DBF-file by using SDF.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.09 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
Marc Vanzegbroeck
Posts: 1163
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium
Contact:

Re: Append SDF error

Post by Marc Vanzegbroeck »

Michel,

This file is indead an xml-file. But this is also a text-file. So why can't he import it, and why always on the same line? It's only with this file. Most other xml-files give no problem.
I head this problem also before when importing prg-files. Most of them are imported complete, other not...

I also try it with clipper52 and also with foxpro, and then the file is imported without any problem!!!

Regards,
Marc
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
User avatar
James Bott
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: Append SDF error

Post by James Bott »

Marc,

It is working fine here. I copied the text.txt from within IE. I wonder if there is some special character after the last line you are getting. Take a look at the original file with a hex editor, or zip it and send it to me at jbott at compuserve dot com.

I am using FWH 10.8/xHarbour.

Regards,
James
Marc Vanzegbroeck
Posts: 1163
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium
Contact:

Re: Append SDF error

Post by Marc Vanzegbroeck »

James,

File send.

Regards,
Marc
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
User avatar
James Bott
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: Append SDF error

Post by James Bott »

For those interested in the solution, I found that if I appended a space to the end of each line in the text.txt file, then APPENDed it, it works fine. I have no idea why this is needed, but it is a viable workaround.

Regards,
James
User avatar
Enrico Maria Giordano
Posts: 8770
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Has thanked: 1 time
Been thanked: 7 times
Contact:

Re: Append SDF error

Post by Enrico Maria Giordano »

Can you make a little sample and try it with Clipper? If it were a real bug I would report it to the developers list.

EMG
Marc Vanzegbroeck
Posts: 1163
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium
Contact:

Re: Append SDF error

Post by Marc Vanzegbroeck »

Enrico,

Like I already explained in previous message, in clipper52 it work just fine.

Here is the link of the text-file in zip format.
http://www.vms.be/FWTest/test.zip

Regards,
Marc
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
User avatar
Euclides
Posts: 157
Joined: Wed Mar 28, 2007 1:19 pm

Re: Append SDF error

Post by Euclides »

Marc,
The fields in TEST.TXT are separated by hex "0A".
If they are before treted by an text editor and saved, the separator becomes "0D0A" and then it works right. It could be a xHarbour error.
Only tested with xHarbour Compiler build 1.0.0 (SimpLex)
Regards, Euclides
User avatar
Enrico Maria Giordano
Posts: 8770
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Has thanked: 1 time
Been thanked: 7 times
Contact:

Re: Append SDF error

Post by Enrico Maria Giordano »

Marc Vanzegbroeck wrote:Enrico,

Like I already explained in previous message, in clipper52 it work just fine.

Here is the link of the text-file in zip format.
[url]http::/www.vms.be/FWTest/test.zip[/url]

Regards,
Marc


Thank you. I'm looking at the sample...

EMG
User avatar
Enrico Maria Giordano
Posts: 8770
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Has thanked: 1 time
Been thanked: 7 times
Contact:

Re: Append SDF error

Post by Enrico Maria Giordano »

Ok, I reported it to the developers list. I tried to fix the problem but it's really too much complicated for me, sorry.

EMG
Marc Vanzegbroeck
Posts: 1163
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium
Contact:

Re: Append SDF error

Post by Marc Vanzegbroeck »

Euclides,

Thanks for the info.

I use now this code as workaround.

Code: Select all | Expand

#INCLUDE "fivewin.CH"
REQUEST DBFCDX
FUNCTION test()
   local vstruct:={}
   memowrit('test.tmp',strtran(memoread('test.txt'),chr(10),chr(13)+chr(10)))
   RDDSETDEFAULT("DBFCDX")
   dbstructuur:={}
   aadd(vstruct,{'LINE','C',199,0})
   dbcreate('import.tmp',vstruct)
   use ('import.tmp') new

   appe from test.tmp sdf
   go top
   browse()
RETURN nil
 


Regards,
Marc
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
User avatar
James Bott
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: Append SDF error

Post by James Bott »

Euclides,

The fields in TEST.TXT are separated by hex "0A".
If they are before treted by an text editor and saved, the separator becomes "0D0A" and then it works right. It could be a xHarbour error.


When I look at the file the fields ARE separated by 0D0A already, so I don't think that is the problem.

James
User avatar
Enrico Maria Giordano
Posts: 8770
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Has thanked: 1 time
Been thanked: 7 times
Contact:

Re: Append SDF error

Post by Enrico Maria Giordano »

The bug has been fixed by Vicente Guerra in the xHarbour CVS.

EMG
User avatar
James Bott
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: Append SDF error

Post by James Bott »

Enrico,

Thanks for getting that done.

James
Post Reply