Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
FPD25 Manually correct 30 bytes of a corrupted Table hea
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00936241
Message ID:
00936490
Views:
24
Hi Rich

>If there is a pattern to the positioning of the extra bytes per record you can modify the following

Yes there is a pattern, this is fine code I will surely give this a try.

>
>FUNCTION glopt
>clear
>lcTekst="aaaaaaaaaabbbd1111111111rrrd2222222222rrrd3333333333rrrd4444444444rrr"  && filetostr(lcFile)
>&& a = header bytes
>&& b = bad header bytes to be removed
>&& d = record delete byte
>&& 1,2,3,4   data bytes for the record
>&& r = extra bytes to be removed from data records
>
>
>lnDataByte = 14
>lnRecLen = 14   && Record Length    delete byte 10 data bytes 3 bytes to remove
>lnRecCount = 4  && Record Count
>lnDelBytes = 3  &&Number of bytes per record to delete
>FOR I = lnRecCount TO 1 STEP -1
>  lnStartByte = lnDataByte + lnReclen*(I-1) + (lnReclen-lnDelbytes)
>  lcTekst = STUFF(lcTekst,lnStartByte,lnDelBytes,"")
>ENDFOR
>lnStartBad = 11 && position of first byte to be removed
>lnHeaderBad = 3 && Number of bytes to remove from header
>lcTekst = STUFF(lcTekst,lnStartBad,lnHeaderBad,"")
>return lcTekst
>
>
>I'm assuming here that the header record has the correct record count, record length, etc. and that the actual file doesn't reflect what the header shows. If not, at least I had some fun writing it.
>
>Best of luck

Thanks
Regards
Bhavbhuti
___________________________________________
Softwares for Indian Businesses at:
http://venussoftop.tripod.com
___________________________________________
venussoftop@gmail.com
___________________________________________
Previous
Reply
Map
View

Click here to load this message in the networking platform