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

Create DBF file from CSV file

Status
Not open for further replies.

143842

Programmer
Feb 8, 2008
4
US
Hi,

We have .csv file which contain 5 million records. We want to convert .csv file into DBF/TXT/SDF/CSV files.

We have header layout in one text file as follows:

Store_Name Number (3)
Store_City Char(3)

We need to add the above header information on DBF file while creating.

We didn't require header information for other file formates.

Can you please suggest how to over come from above issue.
 
I'm confused.. also post what code you have tried.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[noevil]
Travis - Those who say it cannot be done are usually interrupted by someone else doing it; Give the wrong symptoms, get the wrong solutions;
 


Current process:

1. In Perl script we are genetaing Coors.csv file. This file needs to be convert into

TXT/DBF/SDF/CSV formats

2. Conversion process is handling in C++ by passing coors.csv as input as follows:

system("csv2wtf $inputfile $layoutfile $outputfile $format $eofFlg $upcaseFlg")

csv2wtf - calling c++ main program

$inputfile - Input file needs to convert into required format

$layoutfile - Layout file nothing but header file which have columns names

$outputfile - Output filename

$format - Convertable format (CSV/DBF/TXT/SDF)

$eofflg - Y/N

$upcaseflg - Y/N

The above process is working fine if input file has less number records. if the input file has more than 1 million records system termunating with the below error

error: St9bad_alloc()

So can you please suggest me if there is any chnace to implement the conversion logic in Perl script it self to create TXT/DBF/SDF/CSV without calling c++.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top