Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
FGETS() vs. IMPORT/APPEND FROM
Message
From
19/11/1998 04:20:26
 
 
To
19/11/1998 03:10:07
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00158744
Message ID:
00159148
Views:
21
>>So, most of what we use FPW2.x for round here is data conversion. We get .SDF, .XLS and .TXT files from various places, convert the data and send it on. Some of it is coming from our mainframe & going to customers, some is coming from customers heading for our mainframe.
>>
>>In these circumstances my preference is to use the low level file functions to read each record (fixed length records) then validate, break it up and convert it and write it out in its final form (either .DBF, .TXT, or .XLS)
>>
>>My predecessor has been importing to a temporary .DBF, then reading this back, doing the data conversion and writing out the final file.
>>
>>Does anyone have any clue as to which is more efficient? No reason other than curiousity. I've done scads of data conversion in my career and almost always done it this way --even in dBASE, though at times I did have to resort to useing BASIC...
>>
>>Jen
>Jen,
>At the end it's just preference.
>Where applicable I prefer append from to a cursor, process there and send final results to table. Low level has no superiority to append from unless data contains varchar (memo) fields more than 254 in length. Append from OTOH has superiority, you can use powerfull xbase commands and do whatever you would do with lowlevel (in fact lowlevel only includes file open, close, create, read, write etc rest of commands used in parsing are available to append from too). With append from you could do some "validation" automatically (ie: date field - YYYYMMDD expected format and ones that do not respect this with valid dates are "empty" by default), or postpone it to your parser routines by getting all fields as char.

There are other scenarios than the existance of large varchar that make the use of low-level I/O preferable. The existence of non-ASCII data in the record is a big issue in and of itself, as are non-SDF file formats - records without record terminators (real fixed-length records, as opposed to each line terminated with a CR/LF) and multiple record types of equivalent length can all argue strongly in favor of rolling your own rather than using the stock APPEND FROM or IMPORT options.

>I'm disappointed that in conversion you had a need to resort to using BASIC (I never did, thanks to Fox Software, I can't imagine a single thing that is doable in BASIC but not in FOX when the context is "data conversion").
>Cetin
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform