November 02, 2006, 12:09 PM
JeevaHow to create a free-format comma-delimited text file?
I am trying to create a free-format comma-delimited text file. I need all fields separated by comma but no double quotes around the fields. I also need comma-dollar sign character combination(,$) to terminate the record.
Any idea how to do this?
My sample code below:
TABLE FILE COURSE
SUM
EMAIL
CSF_FACULTY
BY
CSF_FACULTY NOPRINT
ON TABLE NOTOTAL
ON TABLE SAVE FILENAME 'C:\temp\AddrList' FORMAT COM
ON TABLE SET PCOMMA ON
END
The above code will generate comma-delimited text file but it has double quotes around each field and no “,$” combination at the end of the line.
Any help would be appreciated.
Thanks,
Jeeva
November 02, 2006, 12:26 PM
Jim_at_LMA quick way: just imbed your own delimiters between selected fields with a terminatior: ,$
DEFINE FILE CAR
CM/A1=',' ;
TERM/A21=',$' ;
END
TABLE FILE CAR
PRINT COUNTRY CM CAR CM MODEL TERM
ON TABLE SAVE AS 'MYFILE'
END
November 02, 2006, 12:31 PM
Francis MarianiFILEDEF HOLD01 DISK C:\TEMP\HOLD01.CSV
TABLE FILE CAR
PRINT
COMPUTE LINE/A60=
COUNTRY || ',' || CAR || ',' || MODEL || ',$';
BY COUNTRY NOPRINT
ON TABLE HOLD AS HOLD01 FORMAT TAB
ON TABLE SET HOLDLIST PRINTONLY
END
All trailing blanks are stripped from alpha [An] fields in a TAB hold file.
Francis
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
November 02, 2006, 01:39 PM
JeevaJim and Francis, Thank you to both of you.