Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help me please...
Message
From
29/12/1998 14:33:47
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00171168
Message ID:
00171301
Views:
33
>First, I agree with you that there are times when low-level file I/O makes sense. I said I know of one situation where it probably makes sense. Many people have probably seen situations where it makes sense, that I haven't seen.
>
>But I have used append from even when there's a "header record" and/or "trailer record" in the text file. (Pause to let you laugh.) You just make the field layout of the file you're appending into more flexible, (a few long text fields) rather than reflecting the real field layout. You take the first and/or last records and parse out the header/trailer information and put it where it goes, and delete them (or use scan-for in the next part to ignore them). Then scan the dbf to parse the "real" records into another dbf.

Faster than that - create sufficient number of tables (one per record layout), and append into each one of them, providing some FOR clause to filter out the records which don't belong to this table. Like,

select first
append from the.txt sdf for isdig(field44) && this type of record always has some digits there, others don't
select second
append from the.txt sdf for not empty(datefield) && if this is not a valid date, it's not a record of type 2
...etc

Of course, the conditions (and mileage) will vary, depending on record structures in each individual case, but at least you don't have to do any record chopping or create intermediate tables.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform