110 pts.
 How to convert characters to numeric in CSV file?
Roy wrote the editors of Search400.com recently, looking for help with a CSV file. He said: "I'm using CRTCSVF to create a csv file. My problem is that my customer number is alphanumeric, but they want it to be numeric (without the quotes) in the CSV file and with the leading zeros intact. "Is there a way to convert character to numeric without suppressing the zeros?" -- Michelle Davidson, editor, Search400.com

Software/Hardware used:
ASKED: September 26, 2005  9:58 AM
UPDATED: November 14, 2009  1:05 AM

Answer Wiki:
Check out website RPGIV.com Bob Cozzi has an example
Last Wiki Answer Submitted:  September 26, 2005  1:14 pm  by  Westdeb   0 pts.
All Answer Wiki Contributors:  Westdeb   0 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Best way is not to use CRTCSVF (whatever that is), but rather do it yourself.

If you’re comfortable with Qshell, you might use the db2 utility to string character fields and numeric fields that you convert to characters together, separated by commas and with whatever quotes you might want wherever you might them. Pipe the output through sed to strip out any heading lines and redirect the outputput to a .CSV file.

You can include leading zeros when you want, or drop them from anywhere. You can do anything that SQL can do to any column.

Tom

 107,715 pts.