Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Extracting Numeric values from a string using REXX

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
avaneendra_linga

New User


Joined: 13 Dec 2006
Posts: 73
Location: Hyderabad

PostPosted: Thu Feb 01, 2007 10:48 am    Post subject: Extracting Numeric values from a string using REXX
Reply with quote

hi,
i have a string from this i have to get the numeric values only....
ex: 45 mainstreet apt 22c
from this i have to get output as 4522 in rexx...
can any body help on this......
Back to top
View user's profile Send private message

ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Thu Feb 01, 2007 11:42 am    Post subject:
Reply with quote

Here is my solution:
Code:
/* REXX */                                                             
                                                                       
STRING = '45 mainstreet apt 22c'                                       
                                                                       
STRING = SPACE(TRANSLATE(STRING,' ','abcdefghijklmnopqrstuvwxyz'),0)   
                                                                       
SAY STRING                                                             
                                                                       
EXIT                                                                   


O.
Back to top
View user's profile Send private message
Steve Coalbran

New User


Joined: 01 Feb 2007
Posts: 85
Location: Stockholm, Sweden

PostPosted: Sat Feb 03, 2007 3:22 pm    Post subject: Re: Extracting Numeric values from a string using REXX
Reply with quote

Sounds like homework for Rexx 1-01?
Code:

SAY NUMONLY("45 mainstreet apt 22c")                   
EXIT                                                   
NUMONLY: RETURN SPACE(TRANSLATE(ARG(1),LEFT("",246),, 
XRANGE('00'X,'EF'X)XRANGE('FA'X,'FF'X)),0)             
SAY NUMONLY("45 mainstreet apt 22c")                   

gives
Code:
4522
Back to top
View user's profile Send private message
Steve Coalbran

New User


Joined: 01 Feb 2007
Posts: 85
Location: Stockholm, Sweden

PostPosted: Sat Feb 03, 2007 3:25 pm    Post subject: Re: Extracting Numeric values from a string using REXX
Reply with quote

Sorry, remove the last SAY line!
It can't be executed obviously, just my sloppy cut+paste!
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Rexx to send an email without SMTP Se... upendrasri All Other Mainframe Topics 6 Sun Nov 19, 2017 7:59 pm
This topic is locked: you cannot edit posts or make replies. ISREDIT Macro is not returning back t... nico_neoz CLIST & REXX 21 Sat Nov 18, 2017 7:40 pm
No new posts REXX LISTDSI () SMSINFO is not working upendrasri CLIST & REXX 4 Fri Nov 17, 2017 11:33 am
No new posts Calling IKJEFT01 program from Rexx upendrasri CLIST & REXX 4 Wed Nov 15, 2017 4:27 pm
No new posts line 52: Name or string > 250 char... Ashishpanpaliya CLIST & REXX 5 Sat Oct 14, 2017 2:29 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us