CPYTOIMPF seemed to do a reasonable job with imbedded comma's and double
quotes.
Where it fell short exporting into a csv file, and then into excel, was a
pure number in a character column like this
CREATE TABLE ROB.EXPORT (MYDEC NUMERIC (7 , 2), MYCHAR CHAR (30 ))
INSERT INTO ROB.EXPORT VALUES(7.2, 7.2)
INSERT INTO ROB.EXPORT VALUES(1, '1"')
INSERT INTO ROB.EXPORT VALUES(2, '1,3')
INSERT INTO ROB.EXPORT VALUES(3, '1,"3')
select * from rob.export
....+....1....+....2..
MYDEC MYCHAR
5.30 7.2
1.00 1"
2.00 1,3
3.00 1,"3
******** End of data
CPYTOIMPF FROMFILE(ROB/EXPORT)
TOSTMF('/rob/export.csv')
STMFCCSID(*PCASCII)
RCDDLM(*CRLF)
RMVBLANK(*TRAILING)
ADDCOLNAM(*SYS)
dspf '/rob/export.csv'
....+....1....+....2....+....3
************Beginning of data
MYDEC,MYCHAR
5.30,"7.2"
1.00,"1"""
2.00,"1,3"
3.00,"1,""3"
************End of Data******
and in Excel I have:
MYDEC MYCHAR
5.3 7.2
1 1"
2 1,3
3 1,"3
Note: the 7.2 appears right adjusted, like a number. Not left adjusted
like a character column. And if I make column C equal to '=B2*5' I'll get
36 in column C.
However, if I do this:
SQL2XLS SQLSTMT('select * from rob/export')
TOXLS('/rob/export2.xls')
COLHDRS(*FLDNAM)
Then it remains a character column. IOW, it remains left adjusted. I can
still do this though: And if I make column C equal to '=B2*5' I'll get 36
in column C.
Rob Berendt
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
[javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.