Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
256 Field Limit - Get me over it
Message
From
03/06/1997 10:50:36
 
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00033358
Message ID:
00034729
Views:
46
>> >2) LLFF, and programmatically interpreting the structure.
>>
>> I have to admit I forgot about that second option - I've only seen a .dbf
>> low-level manipulated once, so it's not an option I think of.
>>
>> It's still not going to be pretty... :)
>
>If you can guarantee the format of the file coming off of the server, it
>doesn't have to be all that pretty:
>
>m.lnInFile = fopen("That.Blasted.DBF")
>=fread(m.lnInFile,200) && Skip the header
>
>do while not feof(m.lnInFile)
>
> * Read in a single record
> m.lcFields = fread(m.lnInFile,m.lnRecordLength)
>
> * Parse the record into the individual values
> m.lcField1 = substr(m.lcFields,100,50)
> m.ldField2 = ctod(substr(m.lcFields,200,8))
> m.llField3 = (substr(m.lcFields,400,1) = "T")
> m.lnField4 = val(substr(m.lcFields,500,20))
>
> * And add them to a table to be checked
> insert into RealTable ( field1, ;
> field2, ;
> field3, ;
> field4 ) ;
> values ( m.lcField1, ;
> m.ldField2, ;
> m.llField3, ;
> m.lnField4 )
>
>enddo
>=fclose(m.lnInFile)
>
>--

This is fine, assuming that you can guarantee that the data structure of the .dbf is never going to change.

One field added in the middle of this after the routine is in production, and you're toast. (As you can tell, I'm a proponent of data dictionaries)
David M. Stowell
Ravenslake Consulting
Chicago, Illinois

e-mail: davidstowell@ravenslakeconsulting.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform