Markspiz


I tryed to open a "dbf" table with VFP to read some data with mi preferred platform (VFP). But in the last field of the record I can't read the right data (VFP return all blanks fileds). If I try to MODIFY STRUCTURE of the table in VFP the lenght of the record is 1614 bytes, an other utility for managing dbf table give me a record size of 1870 bytes. Is there a way to read this table correctly with VFP


Re: I can't see the content of the last field of the record

CetinBasoz


What do you exactly mean What is the "right data" What is another utility. Is it a one that's aware of VFP version you use If that utility is working right, maybe you're not checking the same table Or are you talking about a corrupted table

Can you elaborate your question






Re: I can't see the content of the last field of the record

Markspiz

If I open the dbf table with "Advantage Data Architet" I can see the content of the last field named CFISCALE of any record, if I open and use the table with VFP (I tried versions from 6 to 9) with some simple statemente like:

USE ANAGRAFICHE

INDEX ON ID_ANA TO TMP

BROWSE (or DISPlay or EDIT)

the content of the same field is blank. If you want I can send you the table (say me the way: e-mail or other)

Maybe that VFP need some parameter to correctly open the table






Re: I can't see the content of the last field of the record

CetinBasoz

"Advantage Data Architect" ! So what you're looking at is not a VFP table but Sybase iAnywhere table Just having a .dbf as extension doesn't mean you could open it with VFP.

PS: Opening and browsing a VFP table is simple:

use myTable

browse





Re: I can't see the content of the last field of the record

Markspiz

It is not a VFP table (I'm sure of this) but I never found problems to read its records with VFP, recently the table was updated by the Software House with a new field added that I can't read, when I use BROWSE or any other EDIT command I see the right structure with the field addedd, but the value is every spaces. Do you think I need to use another program to manage this data



Re: I can't see the content of the last field of the record

dni

What vfp version are you using




Re: I can't see the content of the last field of the record

Markspiz

I tryed with versions 6 and 9.



Re: I can't see the content of the last field of the record

dni

You may try with 9 :

Code Snippet

set deleted on

use tablename exclusive

copy to tmp

close databases

use tmp

brow

If still fields are blank and structure are ok it means the fieds are blank. Watch for deleted records ...






Re: I can't see the content of the last field of the record

CetinBasoz

Yes I think you should use another program like ADA as you do. If you want send the table to me (cetin _at_ engineerica dot com - sorry afraid of spamsSmile and I'd check its header and format and what those "spaces" really might be.



Re: I can't see the content of the last field of the record

Markspiz

I just send you an e-mail with the table. thanks for anything you can suggest me.



Re: I can't see the content of the last field of the record

CetinBasoz

I just checked the table. NostalgiaSmile It's a foxbase table, record size is 1850, 172 records and all records have data.



Re: I can't see the content of the last field of the record

Markspiz

Can you check the value of the field named "CFISCALE" of the first record. I think you will find blanks, but the value is "00669360679" you can varify this with ADA.

Thanks.




Re: I can't see the content of the last field of the record

CetinBasoz

I don't have ADA. The value you say exists but it's in another column (PIVA) and repeats in some other rows too.



Re: I can't see the content of the last field of the record

Markspiz

I just sended you "DBFUtils" that is like ADA to open dbf table. You will find the value "00669360679" in the filed named "CFISCALE".





Re: I can't see the content of the last field of the record

CetinBasoz

Looking at your file's header there is a jump from Note_3 field to Stocio (something like thatSmile. It makes a jump of 256 bytes. It might be 2 or more fields that was originally there or somehow they mocked up the header. CFISCALE data is really there if you look at lowlevel but header info is wrong in other words. To fix this one I wrote a little routine for you:

Code Snippet

lcFile = GETFILE('DBF') && select anagrafiche.dbf here

lcCopy = FORCEPATH('Fixed_'+JUSTFNAME(m.lcFile), JUSTPATH(m.lcFile))

lcWholeFile = filetostr(m.lcFile)

lcPart1 = SUBSTR(m.lcWholeFile,1,62*0x20)

lcPart2 = SUBSTR(m.lcWholeFile,62*0x20+1)

lcDummy1 = PADR(PADR('DUMMY1',11,CHR(0))+'C'+BINTOC(1224+244+0,'4RS')+CHR(128),32,CHR(0))

lcDummy2 = PADR(PADR('DUMMY2',11,CHR(0))+'C'+BINTOC(1224+244+128,'4RS')+CHR(128),32,CHR(0))

STRTOFILE(m.lcPart1 + m.lcDummy1 + m.lcDummy2 + m.lcPart2, m.lcCopy)

handle = FOpen(m.lcCopy,12)

FSEEK(m.handle,8,0)

FWRITE(m.handle,BINTOC(0x8e2+0x20*2,"2RS"))

FCLOSE(m.handle)

USE (m.lcCopy)

browse

PS: This code is totally specific to that table. I wanted to do it quickly, therefore hardcoded some of the code. It creates a new table naming it with a 'Fixed_' prefix but anyway take your backup first.