FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Append SDF error
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Append SDF error
Posted: Thu Nov 04, 2010 07:38 PM
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 (fw): Select all Collapse
#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
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Append SDF error
Posted: Fri Nov 05, 2010 12:36 AM

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. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: Append SDF error
Posted: Fri Nov 05, 2010 08:04 AM

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
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Append SDF error
Posted: Fri Nov 05, 2010 04:11 PM

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

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: Append SDF error
Posted: Fri Nov 05, 2010 06:48 PM

James,

File send.

Regards,
Marc

Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Append SDF error
Posted: Fri Nov 05, 2010 07:19 PM

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

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Append SDF error
Posted: Sat Nov 06, 2010 10:38 AM

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

Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: Append SDF error
Posted: Sat Nov 06, 2010 11:42 AM
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
Posts: 159
Joined: Wed Mar 28, 2007 01:19 PM
Re: Append SDF error
Posted: Sat Nov 06, 2010 12:16 PM

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

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Append SDF error
Posted: Sat Nov 06, 2010 12:28 PM
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.
http::/www.vms.be/FWTest/test.zip

Regards,
Marc


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

EMG
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Append SDF error
Posted: Sat Nov 06, 2010 12:55 PM

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

Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: Append SDF error
Posted: Sat Nov 06, 2010 03:16 PM
Euclides,

Thanks for the info.

I use now this code as workaround.

Code (fw): Select all Collapse
#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
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Append SDF error
Posted: Sat Nov 06, 2010 05:36 PM
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
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Append SDF error
Posted: Tue Nov 09, 2010 08:25 AM

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

EMG

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Append SDF error
Posted: Tue Nov 09, 2010 02:53 PM

Enrico,

Thanks for getting that done.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10