Extracting Only Numbers from String in AS400

5 pts.
Tags:
AS/400 Records
I have thousands of address records in AS400 and need to extract only the numbers from the records. Example: 5770 South 900 West #2 and I want it to look like 57709002 Is there any way to do this in AS400? Thank you.

Answer Wiki

Thanks. We'll let you know when a new response is added.

Yes an RPG/COBOL/JAVA program could do it

- the RPG routine might look something like this.

NumFld = blanks

For X = 1 to 80 <– length of address field
StringChar = %subst(AddFld : X : 1);
if StringChar >= ’0′ and StringChar <= ’9′
Eval NumFld = %Trim(NumFld) + StringChar
endif
EndFor

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

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

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following