Converting CVS files
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Re: Converting CVS files
Yes, as Gale said, this it too large of a file for a DBF. So, you need to select a SQL database, then figure out how to import the data into that.
It may still be useful to import into a DBF, but the DBF will still have to be smaller than 4GB so you may have to create several of them by splitting the CSV into several pieces.
James
It may still be useful to import into a DBF, but the DBF will still have to be smaller than 4GB so you may have to create several of them by splitting the CSV into several pieces.
James
Re: Converting CVS files
Gale, James:
I'm talking about splitting the CSV file in 1,000,000 byte pieces. The low level I/O functions creates the first file but does not write anything at all. As I mention in a previous post, with a 10 line CSV test file, it works with no problem.
I tested the link and it gets to the file.
James:
Please try again.
Thank you all guys for your input and help.
I'm talking about splitting the CSV file in 1,000,000 byte pieces. The low level I/O functions creates the first file but does not write anything at all. As I mention in a previous post, with a 10 line CSV test file, it works with no problem.
I tested the link and it gets to the file.
James:
Please try again.
Thank you all guys for your input and help.
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Re: Converting CVS files
Hunter,
Can we see your code for splitting the file?
Can we see your code for splitting the file?
Re: Converting CVS files
I don't think the 4GB limit for a DBF is still valid with Harbour. I wrote a little program to begin testing it and easily created a 7GB DBF.
As the CSV file has 4.078.572 lines the DBF should go close to 30GB. I could not open it with fOpen(). Actually I don´t know if I did not wait enough to load the entire file or if my test hung without any notification.
Code: Select all
REQUEST DBFCDX
FUNCTION Main
LOCAL hCsv
LOCAL cLine
LOCAL nI := 0
RDDSetDefault( "DBFCDX" )
set( 5, 1930 )
CriaDBF()
USE HUNTER NEW EXCL ALIAS HUNT
WHILE hunt->( recNo() ) < 1000000
hunt->( dbAppend() )
ENDDO
hunt->( dbCloseArea() )
RETURN NIL
FUNCTION CriaDBF
LOCAL aStru := {}
aAdd( aStru, { "NPI", "C", 010, 0 } )
aAdd( aStru, { "ETC", "C", 001, 0 } )
aAdd( aStru, { "RNPI", "C", 010, 0 } )
aAdd( aStru, { "EIN", "C", 009, 0 } )
aAdd( aStru, { "PON", "C", 070, 0 } )
aAdd( aStru, { "PLN", "C", 035, 0 } )
aAdd( aStru, { "PFN", "C", 020, 0 } )
aAdd( aStru, { "PMN", "C", 020, 0 } )
aAdd( aStru, { "PNPT", "C", 005, 0 } )
aAdd( aStru, { "PNST", "C", 005, 0 } )
aAdd( aStru, { "PCT", "C", 020, 0 } )
aAdd( aStru, { "POON", "C", 070, 0 } )
aAdd( aStru, { "POONTC", "C", 001, 0 } )
aAdd( aStru, { "POLN", "C", 035, 0 } )
aAdd( aStru, { "POFN", "C", 020, 0 } )
aAdd( aStru, { "POMN", "C", 020, 0 } )
aAdd( aStru, { "PONPT", "C", 005, 0 } )
aAdd( aStru, { "PONST", "C", 005, 0 } )
aAdd( aStru, { "POCT", "C", 020, 0 } )
aAdd( aStru, { "POLNTC", "C", 001, 0 } )
aAdd( aStru, { "PFLBMA", "C", 055, 0 } )
aAdd( aStru, { "PSLBMA", "C", 055, 0 } )
aAdd( aStru, { "PBMACN", "C", 040, 0 } )
aAdd( aStru, { "PBMASN", "C", 040, 0 } )
aAdd( aStru, { "PBMAPC", "C", 020, 0 } )
aAdd( aStru, { "PBMACC", "C", 002, 0 } )
aAdd( aStru, { "PBMATN", "C", 020, 0 } )
aAdd( aStru, { "PBMAFN", "C", 020, 0 } )
aAdd( aStru, { "PFLBPLA", "C", 055, 0 } )
aAdd( aStru, { "PSLBPLA", "C", 055, 0 } )
aAdd( aStru, { "PBPLACN", "C", 040, 0 } )
aAdd( aStru, { "PBPLASN", "C", 040, 0 } )
aAdd( aStru, { "PBPLAPC", "C", 020, 0 } )
aAdd( aStru, { "PBPLACC", "C", 002, 0 } )
aAdd( aStru, { "PBPLATN", "C", 020, 0 } )
aAdd( aStru, { "PBPLAFN", "C", 020, 0 } )
aAdd( aStru, { "PED", "D", 008, 0 } )
aAdd( aStru, { "LUD", "D", 008, 0 } )
aAdd( aStru, { "NPIDRC", "C", 002, 0 } )
aAdd( aStru, { "NPIDD", "D", 008, 0 } )
aAdd( aStru, { "NPIRD", "D", 008, 0 } )
aAdd( aStru, { "PGC", "C", 001, 0 } )
aAdd( aStru, { "AOLN", "C", 035, 0 } )
aAdd( aStru, { "AOFN", "C", 020, 0 } )
aAdd( aStru, { "AOMN", "C", 020, 0 } )
aAdd( aStru, { "AOTP", "C", 035, 0 } )
aAdd( aStru, { "AOTN", "C", 020, 0 } )
aAdd( aStru, { "HPTC1", "C", 010, 0 } )
aAdd( aStru, { "PLN1", "C", 020, 0 } )
aAdd( aStru, { "PLNSC1", "C", 002, 0 } )
aAdd( aStru, { "HPPTS1", "C", 001, 0 } )
aAdd( aStru, { "HPTC2", "C", 010, 0 } )
aAdd( aStru, { "PLN2", "C", 020, 0 } )
aAdd( aStru, { "PLNSC2", "C", 002, 0 } )
aAdd( aStru, { "HPPTS2", "C", 001, 0 } )
aAdd( aStru, { "HPTC3", "C", 010, 0 } )
aAdd( aStru, { "PLN3", "C", 020, 0 } )
aAdd( aStru, { "PLNSC3", "C", 002, 0 } )
aAdd( aStru, { "HPPTS3", "C", 001, 0 } )
aAdd( aStru, { "HPTC4", "C", 010, 0 } )
aAdd( aStru, { "PLN4", "C", 020, 0 } )
aAdd( aStru, { "PLNSC4", "C", 002, 0 } )
aAdd( aStru, { "HPPTS4", "C", 001, 0 } )
aAdd( aStru, { "HPTC5", "C", 010, 0 } )
aAdd( aStru, { "PLN5", "C", 020, 0 } )
aAdd( aStru, { "PLNSC5", "C", 002, 0 } )
aAdd( aStru, { "HPPTS5", "C", 001, 0 } )
aAdd( aStru, { "HPTC6", "C", 010, 0 } )
aAdd( aStru, { "PLN6", "C", 020, 0 } )
aAdd( aStru, { "PLNSC6", "C", 002, 0 } )
aAdd( aStru, { "HPPTS6", "C", 001, 0 } )
aAdd( aStru, { "HPTC7", "C", 010, 0 } )
aAdd( aStru, { "PLN7", "C", 020, 0 } )
aAdd( aStru, { "PLNSC7", "C", 002, 0 } )
aAdd( aStru, { "HPPTS7", "C", 001, 0 } )
aAdd( aStru, { "HPTC8", "C", 010, 0 } )
aAdd( aStru, { "PLN8", "C", 020, 0 } )
aAdd( aStru, { "PLNSC8", "C", 002, 0 } )
aAdd( aStru, { "HPPTS8", "C", 001, 0 } )
aAdd( aStru, { "HPTC9", "C", 010, 0 } )
aAdd( aStru, { "PLN9", "C", 020, 0 } )
aAdd( aStru, { "PLNSC9", "C", 002, 0 } )
aAdd( aStru, { "HPPTS9", "C", 001, 0 } )
aAdd( aStru, { "HPTC10", "C", 010, 0 } )
aAdd( aStru, { "PLN10", "C", 020, 0 } )
aAdd( aStru, { "PLNSC10", "C", 002, 0 } )
aAdd( aStru, { "HPPTS10", "C", 001, 0 } )
aAdd( aStru, { "HPTC11", "C", 010, 0 } )
aAdd( aStru, { "PLN11", "C", 020, 0 } )
aAdd( aStru, { "PLNSC11", "C", 002, 0 } )
aAdd( aStru, { "HPPTS11", "C", 001, 0 } )
aAdd( aStru, { "HPTC12", "C", 010, 0 } )
aAdd( aStru, { "PLN12", "C", 020, 0 } )
aAdd( aStru, { "PLNSC12", "C", 002, 0 } )
aAdd( aStru, { "HPPTS12", "C", 001, 0 } )
aAdd( aStru, { "HPTC13", "C", 010, 0 } )
aAdd( aStru, { "PLN13", "C", 020, 0 } )
aAdd( aStru, { "PLNSC13", "C", 002, 0 } )
aAdd( aStru, { "HPPTS13", "C", 001, 0 } )
aAdd( aStru, { "HPTC14", "C", 010, 0 } )
aAdd( aStru, { "PLN14", "C", 020, 0 } )
aAdd( aStru, { "PLNSC14", "C", 002, 0 } )
aAdd( aStru, { "HPPTS14", "C", 001, 0 } )
aAdd( aStru, { "HPTC15", "C", 010, 0 } )
aAdd( aStru, { "PLN15", "C", 020, 0 } )
aAdd( aStru, { "PLNSC15", "C", 002, 0 } )
aAdd( aStru, { "HPPTS15", "C", 001, 0 } )
aAdd( aStru, { "OPI1", "C", 020, 0 } )
aAdd( aStru, { "OPITC1", "C", 002, 0 } )
aAdd( aStru, { "OPIS1", "C", 002, 0 } )
aAdd( aStru, { "OPII1", "C", 080, 0 } )
aAdd( aStru, { "OPI2", "C", 020, 0 } )
aAdd( aStru, { "OPITC2", "C", 002, 0 } )
aAdd( aStru, { "OPIS2", "C", 002, 0 } )
aAdd( aStru, { "OPII2", "C", 080, 0 } )
aAdd( aStru, { "OPI3", "C", 020, 0 } )
aAdd( aStru, { "OPITC3", "C", 002, 0 } )
aAdd( aStru, { "OPIS3", "C", 002, 0 } )
aAdd( aStru, { "OPII3", "C", 080, 0 } )
aAdd( aStru, { "OPI4", "C", 020, 0 } )
aAdd( aStru, { "OPITC4", "C", 002, 0 } )
aAdd( aStru, { "OPIS4", "C", 002, 0 } )
aAdd( aStru, { "OPII4", "C", 080, 0 } )
aAdd( aStru, { "OPI5", "C", 020, 0 } )
aAdd( aStru, { "OPITC5", "C", 002, 0 } )
aAdd( aStru, { "OPIS5", "C", 002, 0 } )
aAdd( aStru, { "OPII5", "C", 080, 0 } )
aAdd( aStru, { "OPI6", "C", 020, 0 } )
aAdd( aStru, { "OPITC6", "C", 002, 0 } )
aAdd( aStru, { "OPIS6", "C", 002, 0 } )
aAdd( aStru, { "OPII6", "C", 080, 0 } )
aAdd( aStru, { "OPI7", "C", 020, 0 } )
aAdd( aStru, { "OPITC7", "C", 002, 0 } )
aAdd( aStru, { "OPIS7", "C", 002, 0 } )
aAdd( aStru, { "OPII7", "C", 080, 0 } )
aAdd( aStru, { "OPI8", "C", 020, 0 } )
aAdd( aStru, { "OPITC8", "C", 002, 0 } )
aAdd( aStru, { "OPIS8", "C", 002, 0 } )
aAdd( aStru, { "OPII8", "C", 080, 0 } )
aAdd( aStru, { "OPI9", "C", 020, 0 } )
aAdd( aStru, { "OPITC9", "C", 002, 0 } )
aAdd( aStru, { "OPIS9", "C", 002, 0 } )
aAdd( aStru, { "OPII9", "C", 080, 0 } )
aAdd( aStru, { "OPI10", "C", 020, 0 } )
aAdd( aStru, { "OPITC10", "C", 002, 0 } )
aAdd( aStru, { "OPIS10", "C", 002, 0 } )
aAdd( aStru, { "OPII10", "C", 080, 0 } )
aAdd( aStru, { "OPI11", "C", 020, 0 } )
aAdd( aStru, { "OPITC11", "C", 002, 0 } )
aAdd( aStru, { "OPIS11", "C", 002, 0 } )
aAdd( aStru, { "OPII11", "C", 080, 0 } )
aAdd( aStru, { "OPI12", "C", 020, 0 } )
aAdd( aStru, { "OPITC12", "C", 002, 0 } )
aAdd( aStru, { "OPIS12", "C", 002, 0 } )
aAdd( aStru, { "OPII12", "C", 080, 0 } )
aAdd( aStru, { "OPI13", "C", 020, 0 } )
aAdd( aStru, { "OPITC13", "C", 002, 0 } )
aAdd( aStru, { "OPIS13", "C", 002, 0 } )
aAdd( aStru, { "OPII13", "C", 080, 0 } )
aAdd( aStru, { "OPI14", "C", 020, 0 } )
aAdd( aStru, { "OPITC14", "C", 002, 0 } )
aAdd( aStru, { "OPIS214", "C", 002, 0 } )
aAdd( aStru, { "OPII14", "C", 080, 0 } )
aAdd( aStru, { "OPI15", "C", 020, 0 } )
aAdd( aStru, { "OPITC15", "C", 002, 0 } )
aAdd( aStru, { "OPIS15", "C", 002, 0 } )
aAdd( aStru, { "OPII15", "C", 080, 0 } )
aAdd( aStru, { "OPI16", "C", 020, 0 } )
aAdd( aStru, { "OPITC16", "C", 002, 0 } )
aAdd( aStru, { "OPIS16", "C", 002, 0 } )
aAdd( aStru, { "OPII16", "C", 080, 0 } )
aAdd( aStru, { "OPI17", "C", 020, 0 } )
aAdd( aStru, { "OPITC17", "C", 002, 0 } )
aAdd( aStru, { "OPIS17", "C", 002, 0 } )
aAdd( aStru, { "OPII17", "C", 080, 0 } )
aAdd( aStru, { "OPI18", "C", 020, 0 } )
aAdd( aStru, { "OPITC18", "C", 002, 0 } )
aAdd( aStru, { "OPIS18", "C", 002, 0 } )
aAdd( aStru, { "OPII18", "C", 080, 0 } )
aAdd( aStru, { "OPI19", "C", 020, 0 } )
aAdd( aStru, { "OPITC19", "C", 002, 0 } )
aAdd( aStru, { "OPIS19", "C", 002, 0 } )
aAdd( aStru, { "OPISI19", "C", 080, 0 } )
aAdd( aStru, { "OPI20", "C", 020, 0 } )
aAdd( aStru, { "OPITC20", "C", 002, 0 } )
aAdd( aStru, { "OPIS20", "C", 002, 0 } )
aAdd( aStru, { "OPII20", "C", 080, 0 } )
aAdd( aStru, { "OPI21", "C", 020, 0 } )
aAdd( aStru, { "OPITC21", "C", 002, 0 } )
aAdd( aStru, { "OPIS21", "C", 002, 0 } )
aAdd( aStru, { "OPII21", "C", 080, 0 } )
aAdd( aStru, { "OPI22", "C", 020, 0 } )
aAdd( aStru, { "OPITC22", "C", 002, 0 } )
aAdd( aStru, { "OPIS22", "C", 002, 0 } )
aAdd( aStru, { "OPII22", "C", 080, 0 } )
aAdd( aStru, { "OPI23", "C", 020, 0 } )
aAdd( aStru, { "OPITC23", "C", 002, 0 } )
aAdd( aStru, { "OPIS23", "C", 002, 0 } )
aAdd( aStru, { "OPII23", "C", 080, 0 } )
aAdd( aStru, { "OPI24", "C", 020, 0 } )
aAdd( aStru, { "OPITC24", "C", 002, 0 } )
aAdd( aStru, { "OPIS24", "C", 002, 0 } )
aAdd( aStru, { "OPII24", "C", 080, 0 } )
aAdd( aStru, { "OPI25", "C", 020, 0 } )
aAdd( aStru, { "OPITC25", "C", 002, 0 } )
aAdd( aStru, { "OPIS25", "C", 002, 0 } )
aAdd( aStru, { "OPII25", "C", 080, 0 } )
aAdd( aStru, { "OPI26", "C", 020, 0 } )
aAdd( aStru, { "OPITC26", "C", 002, 0 } )
aAdd( aStru, { "OPIS26", "C", 002, 0 } )
aAdd( aStru, { "OPII26", "C", 080, 0 } )
aAdd( aStru, { "OPI27", "C", 020, 0 } )
aAdd( aStru, { "OPITC27", "C", 002, 0 } )
aAdd( aStru, { "OPIS27", "C", 002, 0 } )
aAdd( aStru, { "OPII27", "C", 080, 0 } )
aAdd( aStru, { "OPI28", "C", 020, 0 } )
aAdd( aStru, { "OPITC28", "C", 002, 0 } )
aAdd( aStru, { "OPIS28", "C", 002, 0 } )
aAdd( aStru, { "OPII28", "C", 080, 0 } )
aAdd( aStru, { "OPI29", "C", 020, 0 } )
aAdd( aStru, { "OPITC29", "C", 002, 0 } )
aAdd( aStru, { "OPIS29", "C", 002, 0 } )
aAdd( aStru, { "OPII29", "C", 080, 0 } )
aAdd( aStru, { "OPI30", "C", 020, 0 } )
aAdd( aStru, { "OPITC30", "C", 002, 0 } )
aAdd( aStru, { "OPIS30", "C", 002, 0 } )
aAdd( aStru, { "OPII30", "C", 080, 0 } )
aAdd( aStru, { "OPI31", "C", 020, 0 } )
aAdd( aStru, { "OPITC31", "C", 002, 0 } )
aAdd( aStru, { "OPIS31", "C", 002, 0 } )
aAdd( aStru, { "OPII31", "C", 080, 0 } )
aAdd( aStru, { "OPI32", "C", 020, 0 } )
aAdd( aStru, { "OPITC32", "C", 002, 0 } )
aAdd( aStru, { "OPIS32", "C", 002, 0 } )
aAdd( aStru, { "OPII32", "C", 080, 0 } )
aAdd( aStru, { "OPI33", "C", 020, 0 } )
aAdd( aStru, { "OPITC33", "C", 002, 0 } )
aAdd( aStru, { "OPIS33", "C", 002, 0 } )
aAdd( aStru, { "OPII33", "C", 080, 0 } )
aAdd( aStru, { "OPI34", "C", 020, 0 } )
aAdd( aStru, { "OPITC34", "C", 002, 0 } )
aAdd( aStru, { "OPIS34", "C", 002, 0 } )
aAdd( aStru, { "OPII34", "C", 080, 0 } )
aAdd( aStru, { "OPI35", "C", 020, 0 } )
aAdd( aStru, { "OPITC35", "C", 002, 0 } )
aAdd( aStru, { "OPIS35", "C", 002, 0 } )
aAdd( aStru, { "OPII35", "C", 080, 0 } )
aAdd( aStru, { "OPI36", "C", 020, 0 } )
aAdd( aStru, { "OPITC36", "C", 002, 0 } )
aAdd( aStru, { "OPIS36", "C", 002, 0 } )
aAdd( aStru, { "OPII36", "C", 080, 0 } )
aAdd( aStru, { "OPI37", "C", 020, 0 } )
aAdd( aStru, { "OPITC37", "C", 002, 0 } )
aAdd( aStru, { "OPIS37", "C", 002, 0 } )
aAdd( aStru, { "OPII37", "C", 080, 0 } )
aAdd( aStru, { "OPI38", "C", 020, 0 } )
aAdd( aStru, { "OPITC38", "C", 002, 0 } )
aAdd( aStru, { "OPIS38", "C", 002, 0 } )
aAdd( aStru, { "OPII38", "C", 080, 0 } )
aAdd( aStru, { "OPI39", "C", 020, 0 } )
aAdd( aStru, { "OPITC39", "C", 002, 0 } )
aAdd( aStru, { "OPIS39", "C", 002, 0 } )
aAdd( aStru, { "OPII39", "C", 080, 0 } )
aAdd( aStru, { "OPI40", "C", 020, 0 } )
aAdd( aStru, { "OPITC40", "C", 002, 0 } )
aAdd( aStru, { "OPIS40", "C", 002, 0 } )
aAdd( aStru, { "OPII40", "C", 080, 0 } )
aAdd( aStru, { "OPI41", "C", 020, 0 } )
aAdd( aStru, { "OPITC41", "C", 002, 0 } )
aAdd( aStru, { "OPIS41", "C", 002, 0 } )
aAdd( aStru, { "OPII41", "C", 080, 0 } )
aAdd( aStru, { "OPI42", "C", 020, 0 } )
aAdd( aStru, { "OPITC42", "C", 002, 0 } )
aAdd( aStru, { "OPIS42", "C", 002, 0 } )
aAdd( aStru, { "OPII42", "C", 080, 0 } )
aAdd( aStru, { "OPI43", "C", 020, 0 } )
aAdd( aStru, { "OPITC43", "C", 002, 0 } )
aAdd( aStru, { "OPIS43", "C", 002, 0 } )
aAdd( aStru, { "OPII43", "C", 080, 0 } )
aAdd( aStru, { "OPI44", "C", 020, 0 } )
aAdd( aStru, { "OPITC44", "C", 002, 0 } )
aAdd( aStru, { "OPIS44", "C", 002, 0 } )
aAdd( aStru, { "OPII44", "C", 080, 0 } )
aAdd( aStru, { "OPI45", "C", 020, 0 } )
aAdd( aStru, { "OPITC45", "C", 002, 0 } )
aAdd( aStru, { "OPIS45", "C", 002, 0 } )
aAdd( aStru, { "OPII45", "C", 080, 0 } )
aAdd( aStru, { "OPI46", "C", 020, 0 } )
aAdd( aStru, { "OPITC46", "C", 002, 0 } )
aAdd( aStru, { "OPIS46", "C", 002, 0 } )
aAdd( aStru, { "OPII46", "C", 080, 0 } )
aAdd( aStru, { "OPI47", "C", 020, 0 } )
aAdd( aStru, { "OPITC47", "C", 002, 0 } )
aAdd( aStru, { "OPIS47", "C", 002, 0 } )
aAdd( aStru, { "OPII47", "C", 080, 0 } )
aAdd( aStru, { "OPI48", "C", 020, 0 } )
aAdd( aStru, { "OPITC48", "C", 002, 0 } )
aAdd( aStru, { "OPIS48", "C", 002, 0 } )
aAdd( aStru, { "OPII48", "C", 080, 0 } )
aAdd( aStru, { "OPI49", "C", 020, 0 } )
aAdd( aStru, { "OPITC49", "C", 002, 0 } )
aAdd( aStru, { "OPIS49", "C", 002, 0 } )
aAdd( aStru, { "OPII49", "C", 080, 0 } )
aAdd( aStru, { "OPI50", "C", 020, 0 } )
aAdd( aStru, { "OPITC50", "C", 002, 0 } )
aAdd( aStru, { "OPIS50", "C", 002, 0 } )
aAdd( aStru, { "OPII50", "C", 080, 0 } )
aAdd( aStru, { "ISP", "C", 001, 0 } )
aAdd( aStru, { "IOS", "C", 001, 0 } )
aAdd( aStru, { "POLBN", "C", 070, 0 } )
aAdd( aStru, { "POTIN", "C", 009, 0 } )
aAdd( aStru, { "AONPT", "C", 005, 0 } )
aAdd( aStru, { "AONST", "C", 005, 0 } )
aAdd( aStru, { "AOCT", "C", 020, 0 } )
aAdd( aStru, { "HPTG01", "C", 070, 0 } )
aAdd( aStru, { "HPTG02", "C", 070, 0 } )
aAdd( aStru, { "HPTG03", "C", 070, 0 } )
aAdd( aStru, { "HPTG04", "C", 070, 0 } )
aAdd( aStru, { "HPGT05", "C", 070, 0 } )
aAdd( aStru, { "HPTG06", "C", 070, 0 } )
aAdd( aStru, { "HPTG07", "C", 070, 0 } )
aAdd( aStru, { "HPTG08", "C", 070, 0 } )
aAdd( aStru, { "HPTG09", "C", 070, 0 } )
aAdd( aStru, { "HPTG10", "C", 070, 0 } )
aAdd( aStru, { "HPTG11", "C", 070, 0 } )
aAdd( aStru, { "HPTG12", "C", 070, 0 } )
aAdd( aStru, { "HPTG13", "C", 070, 0 } )
aAdd( aStru, { "HPTG14", "C", 070, 0 } )
aAdd( aStru, { "HPTG15", "C", 070, 0 } )
dbCreate( "HUNTER", aStru )
RETURN NIL
Regards,
André Dutheil
FWH 13.04 HB 3.2 BCC 5.82 MinGW 4.5.2 MSVS 10
André Dutheil
FWH 13.04 HB 3.2 BCC 5.82 MinGW 4.5.2 MSVS 10
Re: Converting CVS files
André:
How do you copy the data from the CSV (text) file to the DBF ? I cannot see it in your code ? Thank you.
James:
Requested code:
How do you copy the data from the CSV (text) file to the DBF ? I cannot see it in your code ? Thank you.
James:
Requested code:
Code: Select all
#define CRLF CHR(13) + CHR(10)
#define CFILEMASK "PART"
#define MAX_SIZE 1024000000 // 1 GB max size per piece
#include "Common.ch"
#include "Directry.ch"
#include "Fileio.ch"
#include "Fivewin.ch"
REQUEST DBFCDX
PROCEDURE Main (cFile)
LOCAL aDirectory, hCsv, cCsvFile, aFiles, nCtr
LOCAL oDlg2, oMeter, nActual := 0, nTotal
DEFAULT cFile TO ""
IF ! FILE(cFile)
MsgInfo(OEMTOANSI("File: " + cFile + " NOT Found"))
cCsvFile := "Data.txt"
ELSE
cCsvFile := cFile
ENDIF
/*
Call procedure to create more manageable txt files.
*/
aDirectory := DIRECTORY(cCsvFile)
IF ! EMPTY(aDirectory)
IF aDirectory[1, F_SIZE] >= MAX_SIZE
aFiles := CreaSlices (@cCsvFile, aDirectory[1, F_SIZE])
ELSE
aFiles := {cCsvFile}
ENDIF
USE Newdata VIA "DBFCDX"
FOR nCtr := 1 TO LEN(aFiles)
hCsv := FOPEN( aFiles[nCtr] )
nActual := 0
nTotal := RECCOUNT()
DEFINE DIALOG oDlg2 TITLE STR(nCtr,4) + "/" + STR(LEN(aFiles),4) + ;
" " + aFiles[nCtr] + " Processing ..."
@ 2, 1 METER oMeter VAR nActual TOTAL nTotal OF oDLg2 SIZE 140 , 20
ACTIVATE DIALOG oDlg2 ON PAINT EVAL({|| oMeter:settotal( nTotal ), ;
DisableX (@oDlg2, .T.), AddRecs (@oMeter, @nActual, @oDlg2, @hCsv)}) ;
CENTERED
FCLOSE( hCsv )
NEXT
XBROWSE()
USE
ENDIF
RETURN
// EOP: Main
STATIC FUNCTION CreaSlices (cCsvFile, nFileSize)
LOCAL nCtr, nPieces, aFiles := {}, nHandle, nOutHandle, cLine, nTotBytes
nPieces := INT(nFileSize / MAX_SIZE)
IF (nFileSize % MAX_SIZE) > 0
nPieces++
ENDIF
nHandle := FOPEN(cCsvFile)
FOR nCtr := 1 TO nPieces
AADD(aFiles, CFILEMASK + STRTRAN(STR(nCtr,4), " ", "0") + ".TXT")
nOutHandle := FCREATE(aFiles[nCtr], FC_NORMAL)
nTotBytes := 0
DO WHILE HB_FReadLine( nHandle, @cLine, CRLF ) == 0 .AND. nTotBytes <= MAX_SIZE
nTotBytes += FWRITE(nOutHandle, cLine + CRLF)
ENDDO
FCLOSE(nOutHandle)
NEXT
RETURN (aFiles)
// EOF: CreaSlices
*******************************************************************************
*** FUNCTION DisableX(oWin, lDisable) to Disable X button of Window/Dialog ***
*******************************************************************************
STATIC FUNCTION DisableX(oWin, lDisable)
#define MF_DISABLED 2
#define MF_BYPOSITION 1024 // 0x0400
LOCAL hMenu := 0, nCount := 0
IF lDisable
hMenu = GetSystemMenu(oWin:hWnd, .F.)
nCount = GetMItemCount(hMenu)
IF oWin:ClassName() = "TDIALOG"
RemoveMenu(hMenu, 1, nOR( MF_BYPOSITION, MF_DISABLED) )
ELSE
RemoveMenu(hMenu, nCount - 1, nOR( MF_BYPOSITION, MF_DISABLED) )
RemoveMenu(hMenu, nCount - 2, nOR( MF_BYPOSITION, MF_DISABLED) )
ENDIF
DrawMenuBar( oWin:hWnd )
ELSE
GetSystemMenu( oWin:hWnd, .T. )
DrawMenuBar( oWin:hWnd )
ENDIF
#undef MF_DISABLED
#undef MF_BYPOSITION
RETURN NIL
// EOF: DisableX
STATIC FUNCTION AddRecs (oMeter, nActual, oDlg2, hCsv)
LOCAL cLine, aVals
DO WHILE HB_FReadLine( hCsv, @cLine, CRLF ) == 0
aVals := &( "{" + cLine + "}" )
IF LEN( aVals ) == 329
aVals[ 37 ] := CTOD( aVals[ 37 ] )
aVals[ 38 ] := CTOD( aVals[ 38 ] )
aVals[ 40 ] := CTOD( aVals[ 40 ] )
aVals[ 41 ] := CTOD( aVals[ 41 ] )
DBAPPEND()
AEVAL( aVals, { |c,i| FieldPut( i, c ) } )
ENDIF
oMeter:set( nActual )
nActual++
SysRefresh()
ENDDO
oDlg2:end()
RETURN (.T.)
// EOF: AddRecs
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Re: Converting CVS files
Hunter,
First problem I have found is that the records are NOT delimited with CRLF but just with LF. This may be the source of a lot of your problems.
I am going to sleep now, but I will look at it some more in the morning.
James
First problem I have found is that the records are NOT delimited with CRLF but just with LF. This may be the source of a lot of your problems.
I am going to sleep now, but I will look at it some more in the morning.
James
Re: Converting CVS files
Hunter,
Try this:
I had to parse fields manually because it did not work with HB_Tokens(). Note I change date fields to char fields to facilitate the import.
Try this:
Code: Select all
#include "fileio.ch"
//ADVANCE CENTER FOR CHIROPRACTIC, ACUPUNCTURE, NUTRITION, LTD.
REQUEST DBFCDX
FUNCTION Main
LOCAL hCsv
LOCAL cLine, aLine
LOCAL nI := 0
RDDSetDefault( "DBFCDX" )
set( 4, "mm/dd/yyyy" )
set( 5, 1930 )
SET DATE AMERICAN
//CriaDBF()
AllAlfaCriaDBF()
USE HUNTER NEW EXCL ALIAS HUNT
/*
WHILE hunt->( recNo() ) < 1000000
hunt->( dbAppend() )
ENDDO
*/
IF ( hCsv := fOpen( "NPIDATA.CSV", 16 ) ) > 0
WHILE HB_FReadLine( hCsv, @cLine, chr( 10 ) ) == 0
nI ++
IF nI > 1
hunt->( dbAppend() )
FillFields( cLine )
ENDIF
ENDDO
fClose( hCsv )
alert( str( nI ) )
ELSE
alert( "BAD LUCK" )
ENDIF
hunt->( dbCloseArea() )
RETURN NIL
STATIC FUNCTION FillFields( cLine )
LOCAL nJ
FOR nJ := 1 TO hunt->( fCount() )
cLine := subStr( cLine, at( ["], cLine ) + 1 )
hunt->( FieldPut( nJ, subStr( cLine, 1, at( ["], cLine ) - 1 ) ) )
cLine := subStr( cLine, at( ["], cLine ) + 1 )
NEXT
RETURN NIL
STATIC FUNCTION xFillFields( aLine )
LOCAL nJ
FOR nJ := 1 TO hunt->( fCount() )
IF nJ <= len( aLine )
IF valType( aLine[ nJ ] ) = "C"
hunt->( FieldPut( nJ, aLine[ nJ ] ) )
ELSE
hunt->( FieldPut( nJ, cToD( aLine[ nJ ] ) ) )
ENDIF
ELSE
EXIT
ENDIF
NEXT
RETURN NIL
FUNCTION AllAlfaCriaDBF
LOCAL aStru := {}
aAdd( aStru, { "NPI", "C", 010, 0 } )
aAdd( aStru, { "ETC", "C", 001, 0 } )
aAdd( aStru, { "RNPI", "C", 010, 0 } )
aAdd( aStru, { "EIN", "C", 009, 0 } )
aAdd( aStru, { "PON", "C", 070, 0 } )
aAdd( aStru, { "PLN", "C", 035, 0 } )
aAdd( aStru, { "PFN", "C", 020, 0 } )
aAdd( aStru, { "PMN", "C", 020, 0 } )
aAdd( aStru, { "PNPT", "C", 005, 0 } )
aAdd( aStru, { "PNST", "C", 005, 0 } )
aAdd( aStru, { "PCT", "C", 020, 0 } )
aAdd( aStru, { "POON", "C", 070, 0 } )
aAdd( aStru, { "POONTC", "C", 001, 0 } )
aAdd( aStru, { "POLN", "C", 035, 0 } )
aAdd( aStru, { "POFN", "C", 020, 0 } )
aAdd( aStru, { "POMN", "C", 020, 0 } )
aAdd( aStru, { "PONPT", "C", 005, 0 } )
aAdd( aStru, { "PONST", "C", 005, 0 } )
aAdd( aStru, { "POCT", "C", 020, 0 } )
aAdd( aStru, { "POLNTC", "C", 001, 0 } )
aAdd( aStru, { "PFLBMA", "C", 055, 0 } )
aAdd( aStru, { "PSLBMA", "C", 055, 0 } )
aAdd( aStru, { "PBMACN", "C", 040, 0 } )
aAdd( aStru, { "PBMASN", "C", 040, 0 } )
aAdd( aStru, { "PBMAPC", "C", 020, 0 } )
aAdd( aStru, { "PBMACC", "C", 002, 0 } )
aAdd( aStru, { "PBMATN", "C", 020, 0 } )
aAdd( aStru, { "PBMAFN", "C", 020, 0 } )
aAdd( aStru, { "PFLBPLA", "C", 055, 0 } )
aAdd( aStru, { "PSLBPLA", "C", 055, 0 } )
aAdd( aStru, { "PBPLACN", "C", 040, 0 } )
aAdd( aStru, { "PBPLASN", "C", 040, 0 } )
aAdd( aStru, { "PBPLAPC", "C", 020, 0 } )
aAdd( aStru, { "PBPLACC", "C", 002, 0 } )
aAdd( aStru, { "PBPLATN", "C", 020, 0 } )
aAdd( aStru, { "PBPLAFN", "C", 020, 0 } )
aAdd( aStru, { "PED", "C", 010, 0 } )
aAdd( aStru, { "LUD", "C", 010, 0 } )
aAdd( aStru, { "NPIDRC", "C", 002, 0 } )
aAdd( aStru, { "NPIDD", "C", 010, 0 } )
aAdd( aStru, { "NPIRD", "C", 010, 0 } )
aAdd( aStru, { "PGC", "C", 001, 0 } )
aAdd( aStru, { "AOLN", "C", 035, 0 } )
aAdd( aStru, { "AOFN", "C", 020, 0 } )
aAdd( aStru, { "AOMN", "C", 020, 0 } )
aAdd( aStru, { "AOTP", "C", 035, 0 } )
aAdd( aStru, { "AOTN", "C", 020, 0 } )
aAdd( aStru, { "HPTC1", "C", 010, 0 } )
aAdd( aStru, { "PLN1", "C", 020, 0 } )
aAdd( aStru, { "PLNSC1", "C", 002, 0 } )
aAdd( aStru, { "HPPTS1", "C", 001, 0 } )
aAdd( aStru, { "HPTC2", "C", 010, 0 } )
aAdd( aStru, { "PLN2", "C", 020, 0 } )
aAdd( aStru, { "PLNSC2", "C", 002, 0 } )
aAdd( aStru, { "HPPTS2", "C", 001, 0 } )
aAdd( aStru, { "HPTC3", "C", 010, 0 } )
aAdd( aStru, { "PLN3", "C", 020, 0 } )
aAdd( aStru, { "PLNSC3", "C", 002, 0 } )
aAdd( aStru, { "HPPTS3", "C", 001, 0 } )
aAdd( aStru, { "HPTC4", "C", 010, 0 } )
aAdd( aStru, { "PLN4", "C", 020, 0 } )
aAdd( aStru, { "PLNSC4", "C", 002, 0 } )
aAdd( aStru, { "HPPTS4", "C", 001, 0 } )
aAdd( aStru, { "HPTC5", "C", 010, 0 } )
aAdd( aStru, { "PLN5", "C", 020, 0 } )
aAdd( aStru, { "PLNSC5", "C", 002, 0 } )
aAdd( aStru, { "HPPTS5", "C", 001, 0 } )
aAdd( aStru, { "HPTC6", "C", 010, 0 } )
aAdd( aStru, { "PLN6", "C", 020, 0 } )
aAdd( aStru, { "PLNSC6", "C", 002, 0 } )
aAdd( aStru, { "HPPTS6", "C", 001, 0 } )
aAdd( aStru, { "HPTC7", "C", 010, 0 } )
aAdd( aStru, { "PLN7", "C", 020, 0 } )
aAdd( aStru, { "PLNSC7", "C", 002, 0 } )
aAdd( aStru, { "HPPTS7", "C", 001, 0 } )
aAdd( aStru, { "HPTC8", "C", 010, 0 } )
aAdd( aStru, { "PLN8", "C", 020, 0 } )
aAdd( aStru, { "PLNSC8", "C", 002, 0 } )
aAdd( aStru, { "HPPTS8", "C", 001, 0 } )
aAdd( aStru, { "HPTC9", "C", 010, 0 } )
aAdd( aStru, { "PLN9", "C", 020, 0 } )
aAdd( aStru, { "PLNSC9", "C", 002, 0 } )
aAdd( aStru, { "HPPTS9", "C", 001, 0 } )
aAdd( aStru, { "HPTC10", "C", 010, 0 } )
aAdd( aStru, { "PLN10", "C", 020, 0 } )
aAdd( aStru, { "PLNSC10", "C", 002, 0 } )
aAdd( aStru, { "HPPTS10", "C", 001, 0 } )
aAdd( aStru, { "HPTC11", "C", 010, 0 } )
aAdd( aStru, { "PLN11", "C", 020, 0 } )
aAdd( aStru, { "PLNSC11", "C", 002, 0 } )
aAdd( aStru, { "HPPTS11", "C", 001, 0 } )
aAdd( aStru, { "HPTC12", "C", 010, 0 } )
aAdd( aStru, { "PLN12", "C", 020, 0 } )
aAdd( aStru, { "PLNSC12", "C", 002, 0 } )
aAdd( aStru, { "HPPTS12", "C", 001, 0 } )
aAdd( aStru, { "HPTC13", "C", 010, 0 } )
aAdd( aStru, { "PLN13", "C", 020, 0 } )
aAdd( aStru, { "PLNSC13", "C", 002, 0 } )
aAdd( aStru, { "HPPTS13", "C", 001, 0 } )
aAdd( aStru, { "HPTC14", "C", 010, 0 } )
aAdd( aStru, { "PLN14", "C", 020, 0 } )
aAdd( aStru, { "PLNSC14", "C", 002, 0 } )
aAdd( aStru, { "HPPTS14", "C", 001, 0 } )
aAdd( aStru, { "HPTC15", "C", 010, 0 } )
aAdd( aStru, { "PLN15", "C", 020, 0 } )
aAdd( aStru, { "PLNSC15", "C", 002, 0 } )
aAdd( aStru, { "HPPTS15", "C", 001, 0 } )
aAdd( aStru, { "OPI1", "C", 020, 0 } )
aAdd( aStru, { "OPITC1", "C", 002, 0 } )
aAdd( aStru, { "OPIS1", "C", 002, 0 } )
aAdd( aStru, { "OPII1", "C", 080, 0 } )
aAdd( aStru, { "OPI2", "C", 020, 0 } )
aAdd( aStru, { "OPITC2", "C", 002, 0 } )
aAdd( aStru, { "OPIS2", "C", 002, 0 } )
aAdd( aStru, { "OPII2", "C", 080, 0 } )
aAdd( aStru, { "OPI3", "C", 020, 0 } )
aAdd( aStru, { "OPITC3", "C", 002, 0 } )
aAdd( aStru, { "OPIS3", "C", 002, 0 } )
aAdd( aStru, { "OPII3", "C", 080, 0 } )
aAdd( aStru, { "OPI4", "C", 020, 0 } )
aAdd( aStru, { "OPITC4", "C", 002, 0 } )
aAdd( aStru, { "OPIS4", "C", 002, 0 } )
aAdd( aStru, { "OPII4", "C", 080, 0 } )
aAdd( aStru, { "OPI5", "C", 020, 0 } )
aAdd( aStru, { "OPITC5", "C", 002, 0 } )
aAdd( aStru, { "OPIS5", "C", 002, 0 } )
aAdd( aStru, { "OPII5", "C", 080, 0 } )
aAdd( aStru, { "OPI6", "C", 020, 0 } )
aAdd( aStru, { "OPITC6", "C", 002, 0 } )
aAdd( aStru, { "OPIS6", "C", 002, 0 } )
aAdd( aStru, { "OPII6", "C", 080, 0 } )
aAdd( aStru, { "OPI7", "C", 020, 0 } )
aAdd( aStru, { "OPITC7", "C", 002, 0 } )
aAdd( aStru, { "OPIS7", "C", 002, 0 } )
aAdd( aStru, { "OPII7", "C", 080, 0 } )
aAdd( aStru, { "OPI8", "C", 020, 0 } )
aAdd( aStru, { "OPITC8", "C", 002, 0 } )
aAdd( aStru, { "OPIS8", "C", 002, 0 } )
aAdd( aStru, { "OPII8", "C", 080, 0 } )
aAdd( aStru, { "OPI9", "C", 020, 0 } )
aAdd( aStru, { "OPITC9", "C", 002, 0 } )
aAdd( aStru, { "OPIS9", "C", 002, 0 } )
aAdd( aStru, { "OPII9", "C", 080, 0 } )
aAdd( aStru, { "OPI10", "C", 020, 0 } )
aAdd( aStru, { "OPITC10", "C", 002, 0 } )
aAdd( aStru, { "OPIS10", "C", 002, 0 } )
aAdd( aStru, { "OPII10", "C", 080, 0 } )
aAdd( aStru, { "OPI11", "C", 020, 0 } )
aAdd( aStru, { "OPITC11", "C", 002, 0 } )
aAdd( aStru, { "OPIS11", "C", 002, 0 } )
aAdd( aStru, { "OPII11", "C", 080, 0 } )
aAdd( aStru, { "OPI12", "C", 020, 0 } )
aAdd( aStru, { "OPITC12", "C", 002, 0 } )
aAdd( aStru, { "OPIS12", "C", 002, 0 } )
aAdd( aStru, { "OPII12", "C", 080, 0 } )
aAdd( aStru, { "OPI13", "C", 020, 0 } )
aAdd( aStru, { "OPITC13", "C", 002, 0 } )
aAdd( aStru, { "OPIS13", "C", 002, 0 } )
aAdd( aStru, { "OPII13", "C", 080, 0 } )
aAdd( aStru, { "OPI14", "C", 020, 0 } )
aAdd( aStru, { "OPITC14", "C", 002, 0 } )
aAdd( aStru, { "OPIS214", "C", 002, 0 } )
aAdd( aStru, { "OPII14", "C", 080, 0 } )
aAdd( aStru, { "OPI15", "C", 020, 0 } )
aAdd( aStru, { "OPITC15", "C", 002, 0 } )
aAdd( aStru, { "OPIS15", "C", 002, 0 } )
aAdd( aStru, { "OPII15", "C", 080, 0 } )
aAdd( aStru, { "OPI16", "C", 020, 0 } )
aAdd( aStru, { "OPITC16", "C", 002, 0 } )
aAdd( aStru, { "OPIS16", "C", 002, 0 } )
aAdd( aStru, { "OPII16", "C", 080, 0 } )
aAdd( aStru, { "OPI17", "C", 020, 0 } )
aAdd( aStru, { "OPITC17", "C", 002, 0 } )
aAdd( aStru, { "OPIS17", "C", 002, 0 } )
aAdd( aStru, { "OPII17", "C", 080, 0 } )
aAdd( aStru, { "OPI18", "C", 020, 0 } )
aAdd( aStru, { "OPITC18", "C", 002, 0 } )
aAdd( aStru, { "OPIS18", "C", 002, 0 } )
aAdd( aStru, { "OPII18", "C", 080, 0 } )
aAdd( aStru, { "OPI19", "C", 020, 0 } )
aAdd( aStru, { "OPITC19", "C", 002, 0 } )
aAdd( aStru, { "OPIS19", "C", 002, 0 } )
aAdd( aStru, { "OPISI19", "C", 080, 0 } )
aAdd( aStru, { "OPI20", "C", 020, 0 } )
aAdd( aStru, { "OPITC20", "C", 002, 0 } )
aAdd( aStru, { "OPIS20", "C", 002, 0 } )
aAdd( aStru, { "OPII20", "C", 080, 0 } )
aAdd( aStru, { "OPI21", "C", 020, 0 } )
aAdd( aStru, { "OPITC21", "C", 002, 0 } )
aAdd( aStru, { "OPIS21", "C", 002, 0 } )
aAdd( aStru, { "OPII21", "C", 080, 0 } )
aAdd( aStru, { "OPI22", "C", 020, 0 } )
aAdd( aStru, { "OPITC22", "C", 002, 0 } )
aAdd( aStru, { "OPIS22", "C", 002, 0 } )
aAdd( aStru, { "OPII22", "C", 080, 0 } )
aAdd( aStru, { "OPI23", "C", 020, 0 } )
aAdd( aStru, { "OPITC23", "C", 002, 0 } )
aAdd( aStru, { "OPIS23", "C", 002, 0 } )
aAdd( aStru, { "OPII23", "C", 080, 0 } )
aAdd( aStru, { "OPI24", "C", 020, 0 } )
aAdd( aStru, { "OPITC24", "C", 002, 0 } )
aAdd( aStru, { "OPIS24", "C", 002, 0 } )
aAdd( aStru, { "OPII24", "C", 080, 0 } )
aAdd( aStru, { "OPI25", "C", 020, 0 } )
aAdd( aStru, { "OPITC25", "C", 002, 0 } )
aAdd( aStru, { "OPIS25", "C", 002, 0 } )
aAdd( aStru, { "OPII25", "C", 080, 0 } )
aAdd( aStru, { "OPI26", "C", 020, 0 } )
aAdd( aStru, { "OPITC26", "C", 002, 0 } )
aAdd( aStru, { "OPIS26", "C", 002, 0 } )
aAdd( aStru, { "OPII26", "C", 080, 0 } )
aAdd( aStru, { "OPI27", "C", 020, 0 } )
aAdd( aStru, { "OPITC27", "C", 002, 0 } )
aAdd( aStru, { "OPIS27", "C", 002, 0 } )
aAdd( aStru, { "OPII27", "C", 080, 0 } )
aAdd( aStru, { "OPI28", "C", 020, 0 } )
aAdd( aStru, { "OPITC28", "C", 002, 0 } )
aAdd( aStru, { "OPIS28", "C", 002, 0 } )
aAdd( aStru, { "OPII28", "C", 080, 0 } )
aAdd( aStru, { "OPI29", "C", 020, 0 } )
aAdd( aStru, { "OPITC29", "C", 002, 0 } )
aAdd( aStru, { "OPIS29", "C", 002, 0 } )
aAdd( aStru, { "OPII29", "C", 080, 0 } )
aAdd( aStru, { "OPI30", "C", 020, 0 } )
aAdd( aStru, { "OPITC30", "C", 002, 0 } )
aAdd( aStru, { "OPIS30", "C", 002, 0 } )
aAdd( aStru, { "OPII30", "C", 080, 0 } )
aAdd( aStru, { "OPI31", "C", 020, 0 } )
aAdd( aStru, { "OPITC31", "C", 002, 0 } )
aAdd( aStru, { "OPIS31", "C", 002, 0 } )
aAdd( aStru, { "OPII31", "C", 080, 0 } )
aAdd( aStru, { "OPI32", "C", 020, 0 } )
aAdd( aStru, { "OPITC32", "C", 002, 0 } )
aAdd( aStru, { "OPIS32", "C", 002, 0 } )
aAdd( aStru, { "OPII32", "C", 080, 0 } )
aAdd( aStru, { "OPI33", "C", 020, 0 } )
aAdd( aStru, { "OPITC33", "C", 002, 0 } )
aAdd( aStru, { "OPIS33", "C", 002, 0 } )
aAdd( aStru, { "OPII33", "C", 080, 0 } )
aAdd( aStru, { "OPI34", "C", 020, 0 } )
aAdd( aStru, { "OPITC34", "C", 002, 0 } )
aAdd( aStru, { "OPIS34", "C", 002, 0 } )
aAdd( aStru, { "OPII34", "C", 080, 0 } )
aAdd( aStru, { "OPI35", "C", 020, 0 } )
aAdd( aStru, { "OPITC35", "C", 002, 0 } )
aAdd( aStru, { "OPIS35", "C", 002, 0 } )
aAdd( aStru, { "OPII35", "C", 080, 0 } )
aAdd( aStru, { "OPI36", "C", 020, 0 } )
aAdd( aStru, { "OPITC36", "C", 002, 0 } )
aAdd( aStru, { "OPIS36", "C", 002, 0 } )
aAdd( aStru, { "OPII36", "C", 080, 0 } )
aAdd( aStru, { "OPI37", "C", 020, 0 } )
aAdd( aStru, { "OPITC37", "C", 002, 0 } )
aAdd( aStru, { "OPIS37", "C", 002, 0 } )
aAdd( aStru, { "OPII37", "C", 080, 0 } )
aAdd( aStru, { "OPI38", "C", 020, 0 } )
aAdd( aStru, { "OPITC38", "C", 002, 0 } )
aAdd( aStru, { "OPIS38", "C", 002, 0 } )
aAdd( aStru, { "OPII38", "C", 080, 0 } )
aAdd( aStru, { "OPI39", "C", 020, 0 } )
aAdd( aStru, { "OPITC39", "C", 002, 0 } )
aAdd( aStru, { "OPIS39", "C", 002, 0 } )
aAdd( aStru, { "OPII39", "C", 080, 0 } )
aAdd( aStru, { "OPI40", "C", 020, 0 } )
aAdd( aStru, { "OPITC40", "C", 002, 0 } )
aAdd( aStru, { "OPIS40", "C", 002, 0 } )
aAdd( aStru, { "OPII40", "C", 080, 0 } )
aAdd( aStru, { "OPI41", "C", 020, 0 } )
aAdd( aStru, { "OPITC41", "C", 002, 0 } )
aAdd( aStru, { "OPIS41", "C", 002, 0 } )
aAdd( aStru, { "OPII41", "C", 080, 0 } )
aAdd( aStru, { "OPI42", "C", 020, 0 } )
aAdd( aStru, { "OPITC42", "C", 002, 0 } )
aAdd( aStru, { "OPIS42", "C", 002, 0 } )
aAdd( aStru, { "OPII42", "C", 080, 0 } )
aAdd( aStru, { "OPI43", "C", 020, 0 } )
aAdd( aStru, { "OPITC43", "C", 002, 0 } )
aAdd( aStru, { "OPIS43", "C", 002, 0 } )
aAdd( aStru, { "OPII43", "C", 080, 0 } )
aAdd( aStru, { "OPI44", "C", 020, 0 } )
aAdd( aStru, { "OPITC44", "C", 002, 0 } )
aAdd( aStru, { "OPIS44", "C", 002, 0 } )
aAdd( aStru, { "OPII44", "C", 080, 0 } )
aAdd( aStru, { "OPI45", "C", 020, 0 } )
aAdd( aStru, { "OPITC45", "C", 002, 0 } )
aAdd( aStru, { "OPIS45", "C", 002, 0 } )
aAdd( aStru, { "OPII45", "C", 080, 0 } )
aAdd( aStru, { "OPI46", "C", 020, 0 } )
aAdd( aStru, { "OPITC46", "C", 002, 0 } )
aAdd( aStru, { "OPIS46", "C", 002, 0 } )
aAdd( aStru, { "OPII46", "C", 080, 0 } )
aAdd( aStru, { "OPI47", "C", 020, 0 } )
aAdd( aStru, { "OPITC47", "C", 002, 0 } )
aAdd( aStru, { "OPIS47", "C", 002, 0 } )
aAdd( aStru, { "OPII47", "C", 080, 0 } )
aAdd( aStru, { "OPI48", "C", 020, 0 } )
aAdd( aStru, { "OPITC48", "C", 002, 0 } )
aAdd( aStru, { "OPIS48", "C", 002, 0 } )
aAdd( aStru, { "OPII48", "C", 080, 0 } )
aAdd( aStru, { "OPI49", "C", 020, 0 } )
aAdd( aStru, { "OPITC49", "C", 002, 0 } )
aAdd( aStru, { "OPIS49", "C", 002, 0 } )
aAdd( aStru, { "OPII49", "C", 080, 0 } )
aAdd( aStru, { "OPI50", "C", 020, 0 } )
aAdd( aStru, { "OPITC50", "C", 002, 0 } )
aAdd( aStru, { "OPIS50", "C", 002, 0 } )
aAdd( aStru, { "OPII50", "C", 080, 0 } )
aAdd( aStru, { "ISP", "C", 001, 0 } )
aAdd( aStru, { "IOS", "C", 001, 0 } )
aAdd( aStru, { "POLBN", "C", 070, 0 } )
aAdd( aStru, { "POTIN", "C", 009, 0 } )
aAdd( aStru, { "AONPT", "C", 005, 0 } )
aAdd( aStru, { "AONST", "C", 005, 0 } )
aAdd( aStru, { "AOCT", "C", 020, 0 } )
aAdd( aStru, { "HPTG01", "C", 070, 0 } )
aAdd( aStru, { "HPTG02", "C", 070, 0 } )
aAdd( aStru, { "HPTG03", "C", 070, 0 } )
aAdd( aStru, { "HPTG04", "C", 070, 0 } )
aAdd( aStru, { "HPGT05", "C", 070, 0 } )
aAdd( aStru, { "HPTG06", "C", 070, 0 } )
aAdd( aStru, { "HPTG07", "C", 070, 0 } )
aAdd( aStru, { "HPTG08", "C", 070, 0 } )
aAdd( aStru, { "HPTG09", "C", 070, 0 } )
aAdd( aStru, { "HPTG10", "C", 070, 0 } )
aAdd( aStru, { "HPTG11", "C", 070, 0 } )
aAdd( aStru, { "HPTG12", "C", 070, 0 } )
aAdd( aStru, { "HPTG13", "C", 070, 0 } )
aAdd( aStru, { "HPTG14", "C", 070, 0 } )
aAdd( aStru, { "HPTG15", "C", 070, 0 } )
dbCreate( "HUNTER", aStru )
RETURN NIL
Regards,
André Dutheil
FWH 13.04 HB 3.2 BCC 5.82 MinGW 4.5.2 MSVS 10
André Dutheil
FWH 13.04 HB 3.2 BCC 5.82 MinGW 4.5.2 MSVS 10
Re: Converting CVS files
James, André:
Thank you for your help and tips. I changed the program, particulary in the HB_FReadLine() function to look up for LF only and the split process went through without problems. Right now the program is appending records. As of now, DBF file size is over 10GB and still going. I'll post when the program finishes. Thank you very much.
Thank you for your help and tips. I changed the program, particulary in the HB_FReadLine() function to look up for LF only and the split process went through without problems. Right now the program is appending records. As of now, DBF file size is over 10GB and still going. I'll post when the program finishes. Thank you very much.
Re: Converting CVS files
Worked here:
Nice 32GB DBF with 4078570 records. Last record might have been lost due to eof in lieu of eol.
Code: Select all
E:\Projetos\Hunter>dir
O volume na unidade E é Novo volume
O Número de Série do Volume é FE0F-23B7
Pasta de E:\Projetos\Hunter
06/09/2013 09:59 <DIR> .
06/09/2013 09:59 <DIR> ..
06/09/2013 09:56 32.285.970.683 HUNTER.dbf
06/09/2013 08:28 705.536 HUNTER.exe
06/09/2013 08:59 29.173 HUNTER.PRG
05/09/2013 18:50 261 m.bat
13/08/2013 02:10 4.951.455.724 npidata.csv
5 arquivo(s) 37.238.161.377 bytes
2 pasta(s) 575.183.507.456 bytes disponíveis
Regards,
André Dutheil
FWH 13.04 HB 3.2 BCC 5.82 MinGW 4.5.2 MSVS 10
André Dutheil
FWH 13.04 HB 3.2 BCC 5.82 MinGW 4.5.2 MSVS 10
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Re: Converting CVS files
32GB DBF.
Good work and great news, André. Thanks.
James
Good work and great news, André. Thanks.
James
Re: Converting CVS files
I think as long as you open dbf exclusive on local NTFS formated drive it will work. I think the limit is based on locking scheme and/or directory structure.
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Re: Converting CVS files
Gale,
James
So, are you saying that it will work to import the data, but you can't use such a large file in a multi-user application due to locking issues?I think as long as you open dbf exclusive on local NTFS formated drive it will work. I think the limit is based on locking scheme and/or directory structure.
James
Re: Converting CVS files
I ran across this bit of information from an article on SAP website on using Visual Foxpro to access DBF files over 2gb.
I think the offset they are talking about is the locking method, where it has to use recno()+offset.Advantage can preserve the DBF file format while allowing the table to grow beyond the 2GB limit of the FoxPro driver. Advantage does this by using a 64-bit unsigned integer to calculate the file offsets, while VFP uses a 32-bit signed integer. Using a larger value to track the file offsets allows Advantage to access DBF files that exceed 2GB in size. However, the native VFP driver will no longer recognize this file as a valid table.
When using Advantage the file size is limited by the operating system and available disk space. When using one of the latest file systems (i.e. NTFS, NSS) the file limit size limit is in Exabytes ( 1EB = 1 billion GB). A more realistic limitation is on the number of records that can be stored in the table. This is currently limited to 2 billion records therefore the maximum size of your table will be 2 billion times your record size.
Re: Converting CVS files
André:
I compiled and ran your program (unaltered) and imported 3687811 records with a file size of 29192706606 bytes. Any suggestions as why it differs from your result ? Thank you very much.
I compiled and ran your program (unaltered) and imported 3687811 records with a file size of 29192706606 bytes. Any suggestions as why it differs from your result ? Thank you very much.