xsharp.eu • Access FPT from ADS with XSharp VO Dialect - Error 7010
Page 1 of 3

Access FPT from ADS with XSharp VO Dialect - Error 7010

Posted: Thu Sep 02, 2021 3:01 pm
by hilberg.it
Hi,
I have difficulties trying to access a MEMO field from a DBF/FPT file through an ADS Server. Code fails with ADS Error 7010 as soon as the memo field is not empty.
Does anyone know, if I am missing a config?

Error:

Code: Select all

Description :    Error 7010:  Problem with Advantage server file read.
Subsystem :    AXDBFCDX
GenCode :    EG_READ Read error
SubCode :    7010 Error 7010:  Problem with Advantage server file read.
FuncSym :    FIELDGET 
Code looks something like this:

Code: Select all

RDDSETDEFAULT("AXDBFCDX")

LOCAL _oDbArtikel as bDBServer
_oDbArtikel = bDBServer{"<IP>:<PORT>ADSTestdArtikel"}

FOR j:=1 UPTO 100
            System.Console.WriteLine(j:ToString() + " Artikel: " + (string)_oDbArtikel:fieldGet(#Arname) + " - " +" Memo: " + (string)_oDbArtikel:fieldGet(#MY_MEMO))
            _oDbArtikel:skip(1)
        NEXT j

_oDbArtikel:Close()

Access FPT from ADS with XSharp VO Dialect - Error 7010

Posted: Thu Sep 02, 2021 4:06 pm
by Jamal
It could be the memo block size.

Check this out:

https://devzone.advantagedatabase.com/d ... e_read.htm

Access FPT from ADS with XSharp VO Dialect - Error 7010

Posted: Fri Sep 03, 2021 8:46 am
by g.bunzel@domonet.de
Hi,

you have to set the blocksize lager then 32:
RDDINFO(_SET_MEMOBLOCKSIZE, 64)
and THEN create your file with MEMO field.
The block size is stroed in the DBF header.

HTH

Gerhard Bunzel

Access FPT from ADS with XSharp VO Dialect - Error 7010

Posted: Fri Sep 03, 2021 9:12 am
by robert
Gerhard,
You are right, but with one small correction: the Block size is stored in the FPT header (as a 16 bit number in the 0 based location 06-07)
If you have a "flexfile compatible" FPT file (which you can recognize because at location 512 there is a string "FlexFile3") then there may be an "alternative block size" defined in the file at location 28 - 29 in the FlexFile header (which starts at location 512). This allows block sizes < 32.

Robert

Access FPT from ADS with XSharp VO Dialect - Error 7010

Posted: Fri Sep 03, 2021 3:54 pm
by g.bunzel@domonet.de
Hi Robert,

....thanks for correction.

Gerhard

Access FPT from ADS with XSharp VO Dialect - Error 7010

Posted: Fri Sep 03, 2021 9:09 pm
by hilberg.it
Thank you very much for your input!

If I recap correctly, you are suggesting that I create a new DBF/FPT file with an Advantage db-driver and blocksize 64 and copy the content from the not-compatible db file into it? Sounds like it is a bit of work, but it could work.

I cannot determine where the dbfcdx.rdd comes from. The DB was last used with VO 2.8. But maybe it was created with an earlier version. So I cannot say for sure if the file is compatible or not. I tried to read the FPT header. At pos. 512 I can read 'FlexFile3'. But if I convert the pos 0-512 from ASCII to HEX, I cannot find any useful information about the applied blocksize. Or would HEX 20 mean blocksize 32?! It's a bit hard to figure out where pos 06-07 respectively 28-29 starts.

Any hints, how I could say for sure, if the FPT file is Advantage-compatible or not?

Thank you very much already. You guys a very helpful!

The FPT header looks like this pos. 0-512:

Code: Select all

2020287F202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
FlexFile3

Access FPT from ADS with XSharp VO Dialect - Error 7010

Posted: Sat Sep 04, 2021 7:28 am
by robert
That header looks corrupt to me.
No wonder that ADS cannot open the file.
I suggest you do this
- open the file in VO
- get its structure (DBStruct())
- close the file
- set the memoblock size to 64
- create a new file with DbCreate() using the structure you read
- use an Append from to append the data from the existing file into the new file
- close the new file
- delete or move the old file to another folder
- rename the new file so it gets the same name as the old one
- open that file
- reindex

That should create a new file and new FPT
The new FTP should have all zeros in the first 512 bytes with a few exceptions, for example the bytes 06-07 when 64 is written for the new block size (hex 0x40)

Robert

Access FPT from ADS with XSharp VO Dialect - Error 7010

Posted: Fri Sep 10, 2021 9:11 pm
by hilberg.it
Thanks Robert. I am trying to code it. So far I am stuck with the APPEND FROM call in VO2.8

Code: Select all

LOCAL _oDbArtikel as bDBServer
LOCAL _aStruData	as ARRAY
_oDbArtikel = bDBServer{"C:tmpdArtikel"}
_aStruData := _oDbArtikel:DbStruct
_oDbArtikel:Close()  
RDDINFO(_SET_MEMOBLOCKSIZE, 64)                                              
DBCREATE("C:tmptest", _aStruData) 
// here APPEND FROM "C:tmpdArtikel"
How should I write the APPEND FROM call? I don't know the syntax. I've just found this Doc CA-Clipper Docs

Header so far looks a bit different already, especially the bytes 6-7 with hex 0x40:

Code: Select all

20202010202020402020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
20202020202020202020202020202020
If you could help me with coding the append call, I could test the result :-) Thx

Access FPT from ADS with XSharp VO Dialect - Error 7010

Posted: Sat Sep 11, 2021 10:15 am
by g.bunzel@domonet.de
You will find every syntax in the X#-Help:
https://www.xsharp.eu/runtimehelp/html/ ... _DbApp.htm

HTH

Gerhard

Access FPT from ADS with XSharp VO Dialect - Error 7010

Posted: Sat Sep 11, 2021 8:48 pm
by hilberg.it
Thanks so much! That worked. :-)

But unfortunately I received for one of two files that I was trying to move to ADS a "Corruption Detected" Error (In Function FlexGetMemoData; On Line: 1340; Function DbApp). See attachment.

Any ideas, if I could use in this case something else than "DBApp()"? Or recover the file somehow? I can still open it in VO, though. I could see nothing in the file at line 1340. But it could be that the file is indeed corrupted. I am thinking about a loop that reads from the corrupted file in VO and inserts entry by entry into the new file. Are there better solutions?