you're right. thank you. i will try it your way.
One more thing..
I changed the code page of the table that contains the data I am converting to the text file.
Would this effect using the COPY TO and format of the text file I am creating?
The tables came from a project created with foxpro for windows version 2.6a.
When I rolled the project up to vfp 9 sp2, and ran it, i kept getting prompted to select a code page for these tables.
So I set the code page of these tables in the code.
I selected the code page on the tables to 1252
*!* **********************************************************
*!* USE ALLTRIM('c:\ops\init\pretnew.dbf') IN 0 ALIAS pretnew
*!* SELECT pretnew
*!* COPY TO 'c:\ops\init\pretnew1.dbf' WITH cdx as 1252
*!* USE
*!*
*!* **********************************************************
Any suggestions would be greatly appreciated.
Regards,
Deb
>It's not the same. The characters fields are enclosed in double quotes in the file. IOW, you'll get "20080101" instead of 20080101.
>
>Also you could use DTOS() to convert a date to YYYYMMDD string.
>
>>
>>i did it this way
>>
>>* 08.26.2009 df. Fix the date fields.
>>IF USED('tcprsys')
>> SELECT tcprsys
>> USE
>>ENDIF
>>SELECT * , ;
>> SUBSTR(DTOC(s_weekend),7,4) + SUBSTR(DTOC(s_weekend),1,2) + SUBSTR(DTOC(s_weekend),4,2) as weekend, ;
>> SUBSTR(DTOC(s_chk_date),7,4) + SUBSTR(DTOC(s_chk_date),1,2) + SUBSTR(DTOC(s_chk_date),4,2) as chkdate ;
>> FROM prsys INTO CURSOR tcprsys readwrite
>>
>>SELECT tcprsys
>>COPY TO (ALLTRIM((pathtxt) + "dnsys" + (gc_accno) + ".DAT")) ;
>> FIELDS s_co_code, s_payperio, WEEKEND, ;
>> s_city, s_state, s_zip, s_owner, CHKDATE ;
>> FOR (gc_accno = s_co_code) ;
>> TYPE DELIMITED
>>
>
>>
>>
>>>Looks like VFP exports dates differently than Fox 2.x. I guess you'll have to postprocess the file. Something like
>>>
>>>SET DATE YMD
>>>SET MARK TO "|"
>>>
>>>COPY TO (lcFileName) DELIMITED
>>>STRTOFILE(CHRTRAN(FILETOSTR(lcFileName), "|", ""), lcFileName)
>>>SET MARK TO
>>>* Restore SET DATE
>>>...
>>>
>>>
>>>>SELECT prsys
>>>>COPY TO (ALLTRIM((pathtxt) + "dnsys" + (gc_accno) + ".DAT"));
>>>> FOR (gc_accno = s_co_code);
>>>> TYPE DELIMITED
>>>>