File is not a DBF! 
Author Message
 File is not a DBF!
Get a copy of dSalvage, run a search on the WEB and you should be able to
get to the company. I think the program is $200.

"In the computer business, the only constant is change."



Sun, 23 Aug 1998 03:00:00 GMT
 File is not a DBF!

Quote:
> I need a repair tool to fix a dbf. I think the user turned off
> the computer while the table was open in exclusive mode. Any
> suggestions?

Often, the problem is just a discrepancy between the file size and the
number of records in the header.  The following prog will fix that.  I've
used it only on V2.6 (DOS) .DBFs.  Take a backup!  :-)

PROCEDURE fixdbf
PARAMETERS file_name

PRIVATE fh, header, file_size, rec_size, rec1_pos, all_recs
PRIVATE act_recs, hdr_recs, start_pos

DIMENSION file_info[1,5]

IF ADIR(file_info, file_name) <> 1
   RETURN
ENDIF

file_size = file_info[1,2]
fh = FOPEN(file_name, 2)
start_pos = FSEEK(fh, 0)
header = FREAD(fh, 12)
hdr_recs = bin2num( SUBSTR(header, 5, 4) )
rec1_pos = bin2num( SUBSTR(header, 9, 2) )
rec_size = bin2num( SUBSTR(header, 11, 2) )
all_recs = file_size - rec1_pos - 1
act_recs = all_recs / rec_size

IF act_recs <> hdr_recs
   header = STUFF(header, 5, 4, num2bin(act_recs,4))
   =FSEEK(fh, start_pos)
   =FWRITE(fh, header)
ENDIF

= FCLOSE(fh)
RETURN

FUNCTION bin2num
PARAMETERS binary
PRIVATE result

result = 0

FOR b = LEN(binary) TO 1 STEP -1
   result = result * 256 + ASC( SUBSTR(binary, b, 1) )
ENDFOR

RETURN result

FUNCTION num2bin
PARAMETERS numeric, bin_size
PRIVATE result, numba

result = ''
numba = numeric

FOR b = 1 TO bin_size
   result = result + CHR(numba % 256)
   numba = INT(numba / 256)
ENDFOR

RETURN result

Hope this works for you!

Stuart Fairful
Bytemark Ltd
Glasgow
+44 (141) 226 4890



Sun, 23 Aug 1998 03:00:00 GMT
 
 [ 2 post ] 

 Relevant Pages 

1. Convert file.db (NOT .dbf) to file.xls

2. How to combine the data from two .dbf database file to one new .dbf database file

3. _qsqlxxx.dbf NOT in exe-file directory ???

4. Delphi 1.0, DBF FILE DELETED BUT NOT

5. Access 2000 and .dbf files (not really VB question)

6. Delphi programing, DBF FILE DELETED BUT NOT PACK

7. Paradox does not open files dbf through a net Windows NT 4.0

8. File is not a DBF!

9. Not a table/DBF file

10. Error message - Not a table/DBF file

11. Not a DBF file - save.txt [01/01]

12. could not open non DSN connection to .dbf file from aspx.vb page


 
Powered by phpBB® Forum Software