| Subject |
Re: importing text file programmatically |
| From |
Emeka Ossai <megameks@yahoo.com> |
| Date |
Tue, 08 Feb 2022 16:53:40 -0500 |
| Newsgroups |
dbase.getting-started |
| Attachment(s) |
custodian0402.txt |
Hi Mervyn,
The problem now is that same dbf structure, same command but could not append another text file of same structure correctly.
Please help me append the attached text file if you can detect the error.
Thank you
Emeka
Mervyn Bick Wrote:
> On 2022/02/08 17:34, Emeka Ossai wrote:
> > Oh thank you Mervyn
> >
> > I have attached the files
>
> The \"out of line\" problem in field8 was caused by the field definition
> for field7 being numeric(5,2) instead of numeric(6,2).
>
> Don\'t use \"date\" as a fieldname. It is a SQL reserved word and it will
> cause problems sooner or later. I\'ve changed it to DDATE. You will
> need to recreate the indexes.
>
> Attached is a little program to append from the text file and then
> populate the ddate and cdate fields.
>
> Mervyn.
> cFile = \'custodian0207.txt\'
> use custodian
> append from &cFile sdf
> go top
> scan
> cDate = ltrim(rtrim(field10))
> replace ddate with new date(val(substr(ltrim(field10),1,4)),val(substr(ltrim(field10),5,2))-1,val(substr(ltrim(field10),7,2)))
> replace cdate with dtoc(ddate)
> endscan
> use
| UBNOM 2 130924079 32113306INTBREW 8 5.40RIVERS STATE MIN OF FIN INCORPORATED-TRATLFS 27641293 20220204
UBNOM 2 130924079 32113306INTBREW 20 5.40RIVERS STATE MIN OF FIN INCORPORATED-TRATLFS 27641294 20220204
UBNOM 2 130924079 32113306INTBREW 2000 5.30RIVERS STATE MIN OF FIN INCORPORATED-TRATLFS 27641298 20220204
UBNOM 2 130924079 32113306INTBREW 39500 5.40RIVERS STATE MIN OF FIN INCORPORATED-TRATLFS 27641292 20220204
UBNOM 2 130924079 32113306INTBREW 50000 5.30RIVERS STATE MIN OF FIN INCORPORATED-TRATLFS 27641296 20220204
UBNOM 2 130924079 32113306INTBREW 175507 5.40RIVERS STATE MIN OF FIN INCORPORATED-TRATLFS 27641291 20220204
UBNOM 2 130924079 32113306INTBREW 500000 5.30RIVERS STATE MIN OF FIN INCORPORATED-TRATLFS 27641297 20220204
UBNOM 2 130924079 32113306INTBREW 500000 5.35RIVERS STATE MIN OF FIN INCORPORATED-TRATLFS 27641295 20220204
UBNOM 2 130924079 32113306INTBREW 732965 5.30RIVERS STATE MIN OF FIN INCORPORATED-TRATLFS 27641311 20220204
|
|