Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

define a block of memory 2

Status
Not open for further replies.

cruicu

Technical User
Nov 25, 2002
24
RO
Hello all!

I must transfer a lot of dates from dbf file to txt file.
The dbf file is very large and using Memo fields for transfer take more time (because it access every time the txt file).
Somebody know a method to transfer dates from dab file to txt file (by appending) using blocks of memory?
How can I define a memory area and write in it and after this to transfer this memory area to txt file?

Thank you all!
 
Maybe u can try using arrays. Copy X records to array, dump to txt, copy next X records to array, dump to txt...

Or you can use SCATTER and GATHER.
 
How about scanning throught the file, gathering say 100 records and dumping it with STRTOFILE()?:
Code:
USE MyTable
STORE '' TO tmpstr
SCAN
   SCATTER MEMVAR 
   tmpstr = m.f1 + STR(m.f2) + DTOS(m.f3) + ALLTRIM(m.f4)....
   IF MOD(RECNO(), 100) = 0
      STRTOFILE(tmpstr, "MyFile.TXT", .T.)  &&... .T. = append to file
      tmpstr = ''
   ENDIF
ENDSCAN
Dave S. [cheers]
 
Actually, unless the data you're storing in the text file exceeds 16MB, Dave's solution doesn't even need to stop every hundred records - just keep appending! This string is as close to using a block of memory as you can probably get.

Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top