>>
>>>I want to import a text file that has about 30,000 records
>>>into vfp50. Can visual foxpro handle 30,00 or maybe 100,00
>>>records? thanks
>>I have several apps running that process tables of several million records. I chose FoxPro because it had the fastest db engine available. My apps regularly post several 100,000 record files in text format using low level file functions to a VFP .dbf of 1.8 million records.
>>
>>"30,000 Records?" You won't have time to get a cup of coffee before VFP has processed your records, up, down, sideways and backwards!
>
>thanks Steffen for your answer.. with your text file, are you using APPEND FROM to post to the vfp dbf file? I want to move a text file (using a low level file
>functions) to a vfp dbf file. Could you show me some code?..thanks again..rob
Robert,
Here is the code! Have Fun!
JP Steffen
PARAMETERS lcTapeFile
** This Procedure Reads a fixed length ASCII file using low-level file functions
** And INSERTS the data into a DBF
** Note: The files have been loaded to disk via 9-Track Tape transport
lnBCnt = 0
IF FILE(lcTapeFile)
lnHand = fOpen(lcTapeFile) && Open the Text File
IF lnHand <= 0
CLEAR
WAIT WINDOW "Error Opening Tape File!"
RETURN
ENDIF
ELSE
CLEAR
WAIT WINDOW "Error Tape File not found!"
RETURN
ENDIF
lcBuff = SPACE(7300) && The record length is 730 so we read 10 recs at a time
DO WHILE .T.
lnBuff = FREAD(lnhand,@lcBuff,7300) && read in 10*730 byte records
lnOffSet = 0
IF lnBuff < 730 && If we read less that 730, we must be done
EXIT
ENDIF
DO WHILE lnBuff > 0
IF lnBuff < 730
EXIT
ENDIF
** Initialize all fields
m.lcCo = SUBSTR(lcBuff,lnOffSet+1,2)
m.cssn = SUBSTR(lcBuff,lnOffSet+4,9)
m.cssfx = SUBSTR(lcBuff,lnOffSet+13,1)
m.clast = SUBSTR(lcBuff,lnOffSet+24,20)
m.cfirst = SUBSTR(lcBuff,lnOffSet+44,15)
INSERT INTO DBFFILE FROM MEMVAR
lnBuff = lnBuff - 730 && Pick off 730 bytes at a time
lnOffset = lnOffset + 730 && Offset increases to 7300 then cycles
ENDDO && while there are bytes in the record buffer
ENDDO && while there are bytes in the file
fClose(lcTapeFile) && we are done
RETURN
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only