IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

To find the number of occurance


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vasan_4u

New User


Joined: 28 Jun 2005
Posts: 35
Location: chennai

PostPosted: Tue Jan 15, 2008 2:10 am
Reply with quote

I need to find the number of occurance of '&' in this string.

'&HLQV&VER&SYS..POST20.TEMP.LTRQ.CLUSTER'

Is there any command available or can any one help me in doing it.
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Tue Jan 15, 2008 2:48 am
Reply with quote

Code:

/* REXX */
thevar = '&HLQV&VER&SYS..POST20.TEMP.LTRQ.CLUSTER'
cnt = 0
Do n = 1 To Length(thevar)
  If Substr(thevar,n,1) = '&' Then cnt = cnt + 1
End
Say cnt

thevar = Translate(thevar,' ','&')
Say Words(thevar)
Exit
Back to top
View user's profile Send private message
vasan_4u

New User


Joined: 28 Jun 2005
Posts: 35
Location: chennai

PostPosted: Tue Jan 15, 2008 8:29 pm
Reply with quote

thank you very much ...
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Substring number between 2 characters... DFSORT/ICETOOL 2
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Generate random number from range of ... COBOL Programming 3
No new posts Increase the number of columns in the... IBM Tools 3
Search our Forums:

Back to Top