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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trouble loading file with FileSystemObject

Status
Not open for further replies.

wawalter

Programmer
Aug 2, 2001
125
0
0
US
Hello,

I am trying to load large text files in to a dbf. I was using the native fox file functions and it worked file until I hit the 2 gig limit. So, after reading this, I switched to use FileSystemObject (FSO), but I'm having a problem.

I use substr to split each line and keep only the parts I want in order to make the file smaller. I am loading 40 fields each between 2 and 40 characters wide out of a 4023 character wide record. The first 20 or so fields load fine and the last field loads fine, but the 20 or so in the middle load only NULL characters (ascii 0) even though there are text characters in the text file in those locations.

It does load all the records in to my table just with NULLs in the middle fields.

Using the VFP functions all the data loaded fine, until I hit the file size limit.

I am using VFP 7.0.

Thanks for any help,
Bill
 
My suggestion would be to find yourself an editor that can handle files of any size and break the original file into several different files. You could then import them into several tables.


-Dave Summers-
[cheers]
Even more Fox stuff at:
 
Following Dave's suggestion above I have used:
Programmers File Editor

However an even better way that I use is to import the Text file into SQL Server (whichever version). The 2GB size limitation is not present.

Then once the file is in SQL Server I export separate parts as needed - each part being smaller than the 2GB limitation.

The I can work easily with the results in VFP.

You may also look at the posting: thread184-1491143 where similar topics are discussed.

Good Luck
JRB-Bldr
 
Thanks for the suggestions. I'd like to avoid SQL server if possible. This is what I normally do, but this job needs to turn around fast and I've found the download from SQL Server can be pretty slow.

As far as using the editor, I'd rather not have the manual step of splitting the file before loading it. Do you know if this can be automated?

For now, I think I'll test writing something in C# and see if I get all the NULL characters there too.

Thanks again,
Bill
 
Well, if you're well versed in C# (or any C for that matter), you could always automate the file split. A simple read of the file while writing it out into smaller chunks would work.


-Dave Summers-
[cheers]
Even more Fox stuff at:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top