Q

Removing a comma from an alpha field

This Content Component encountered an error
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) 

==================================
MORE INFORMATION ON THIS TOPIC
==================================

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.

This was first published in November 2004

Dig deeper on iSeries ILE programming

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchEnterpriseLinux

SearchDataCenter

Close