Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem in Importing text files
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Problem in Importing text files
Divers
Thread ID:
00483003
Message ID:
00483003
Vues:
51
Hi every body

Sencond time the same message is displaying.

I have one text file containing 55,000 records. All the fields are in fixed spaces. When I check in DOS the spaces are ok. But when I use import wizard (VFP 6), it gives the text in improper spaces, looks like some spaces are missing and the remaining fields are loosing their width. It is not possible to use commas to separate the fields. Is there any way to use this text file that all the spaces should be the same as it looks in DOS (edit text file).

The main goal is to import text file day by day for data veryfication. I wrote a small program using command APPEND FROM FILE NAME . Then it will append all the record in one field. After that i use replace command in do while eof() to replace all the fields. It is working 90% ok but some text is missing during first append from text file. The following is the program

creat table ivas400.dbf(ivas400 c(155),asidep c(2),asino c(6),asidesc c(40),asibrand c(10),asiwhp c(4),asimp c(4),asisp c(4),asiboxco c(12),asiboxp n(10,2),asipcsco c(12),asipcsp n(10,2),asiwhqty n(10,0),ast1qty n(10),ast2qty n(10),ast5qty n(10),expdt c (8),stat c (2),depno c(8))

append from c:\itemver\ivas400.txt delimited
go top
do while .not. eof()
replace asidep with ivas400
replace asino with substr (ivas400,3,8)
replace asidesc with substr(ivas400,9,48)
replace asibrand with substr(ivas400,49,58)
replace asiwhp with substr(ivas400,59,62)
replace asimp with substr (ivas400,63,66)
replace asisp with substr(ivas400,67,70)
replace asiboxco with substr(ivas400,71,82)
replace asiboxp with val(substr(ivas400,83,8))+(val(substr(ivas400,91,2))/100) && to convert text to numeric
replace asipcsco with substr (ivas400,93,104)
replace asipcsp with val(substr(ivas400,105,8))+ (val(substr(ivas400,113,2))/100)
replace asiwhqty with val(substr(ivas400,115,10))
replace ast1qty with val(substr(ivas400,125,10))
replace ast2qty with val(substr(ivas400,135,10))
replace ast5qty with val(substr(ivas400,145,10))
replace expdt with substr(ivas400,155,10)
replace depno with substr(ivas400,1,8)
skip
loop
enddo
alter table ivas400.dbf drop column ivas400 alter column asiboxco n(12) alter column asipcsco n(12) alter column asidep n(2) alter column depno n(8)
return
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform