Question

Asked:
Asked By:
Jan 7 2009   4:15 PM GMT
Bolillo1234   5 pts.

Extracting Only Numbers from String in AS400


AS/400 Records, AS/400 Record Reorganization

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.

Subscribe to Alerts! Get questions and answers delivered to your Inbox.


E-mail me updates on this question



   SUBSCRIBE

hidden modal window

Answer Wiki (Improve, edit or add to this answer)


 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0



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
  • AddThis Social Bookmark Button

Browse more Questions and Answers on AS/400.

Looking for relevant AS/400 Whitepapers? Visit the Search400.com Research Library.


Discuss This Answer


You must be logged-in to discuss a question. Log-in/Register