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
 
how to seperate the words which are with commas

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

New User


Joined: 17 Dec 2010
Posts: 3
Location: bangalore

PostPosted: Tue Feb 08, 2011 5:21 pm    Post subject: how to seperate the words which are with commas
Reply with quote

if there is a sentance like (Ant, Car, Rat)

I want the output to be

The first word is Ant
The second word is Car
The third word is Rat


How it is possible using Rexx ?

Can any one kindly let me knw ?
Back to top
View user's profile Send private message

Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1775
Location: Bloomington, IL

PostPosted: Tue Feb 08, 2011 5:28 pm    Post subject: Re: how to seperate the words which are with commas
Reply with quote

chandru1483 wrote:
if there is a sentance like (Ant, Car, Rat)

I want the output to be

The first word is Ant
The second word is Car
The third word is Rat


How it is possible using Rexx ?

Can any one kindly let me knw ?

You can use PARSE VALUE, if the number of tokens is known, or POS and SUBSTR in a loop, if it is not (you could actually use PARSE VALUE there, too; I think that POS/SUBSTR logic will be more understandable. Feel free not to agree).
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10308
Location: italy

PostPosted: Tue Feb 08, 2011 5:44 pm    Post subject: Reply to: how to seperate the words which are with commas
Reply with quote

Code:
string= "one,two, three ,four, five ,six ,seven, eight, nine ,more ,more, more, more"
ordern= "first second third fourth fifth sixth seventh eighth ninth"
do  i = 1 while ( string <> "" )
    parse var string tokn "," string
    tokn.i = strip(tokn)
    if  i > 9 then ,
        say right(i,2) "the umpteen token is >>"tokn.i"<<"
    else
        say right(i,2) "the "left(word(ordern,i),7)" token is >>"tokn.i"<<"
end

but You might willing to find an algorithmic solution to obtain for a number
the same in words and the relatibe ordinal ( always in words )
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 Using ICETOOL, how we can seperate th... bshkris SYNCSORT 5 Tue May 09, 2017 8:33 pm
No new posts Splitting of single report to seperat... abdulrafi TSO/ISPF 7 Mon Mar 27, 2017 3:59 pm
No new posts Combine columns without breaking words Indrajit_57 SYNCSORT 1 Sat Mar 19, 2016 9:33 am
No new posts Splitting of the text without affecti... mkk157 DFSORT/ICETOOL 4 Wed Feb 18, 2015 6:10 pm
No new posts Quick3270 Macro is giving error for a... Tanuz All Other Mainframe Topics 4 Sat Dec 06, 2014 8:41 am

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