Problem solve Get help with specific problems with your technologies, process and projects.

Removing a comma from an alpha field

Is there a built in function available that allows me to remove a comma from an alpha field so I can move the field value to a numeric field. For example, the alpha field is 10 characters long and has a value of 1,000,000. I need it to look like this: 1000000. Any suggestions would be greatly appreciated.
Use the %DEC BIF with translation to convert the string to a packed number after converting the commas to blanks. The following example is from the WebSphere(R) Development Studio ILE RPG Reference at the IBM Web site and handles the currency symbol $ and the cheque protect symbol * as well as the thousands separator:

D data            s             20a   inz('$1,234,567.89')
D num             s             21p 9 

Eval  num = %dec(%xlate('$*,' : '   ' : data) : 21 : 9) 


The Best Web Links: tips, tutorials and more.

Visit the ITKnowledge Exchange and get answers to your developing questions fast.

Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.

Dig Deeper on iSeries ILE programming