MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

find and replace a string

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF
View previous topic :: View next topic  
Author Message
uneasabe
Beginner


Joined: 26 Oct 2003
Posts: 8
Topics: 4
Location: Mumbai

PostPosted: Tue Nov 04, 2003 12:53 am    Post subject: find and replace a string Reply with quote

hi,
I want to know the command which will enable me to find and replace a string using rexx
Thanx
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
ofer71
Intermediate


Joined: 12 Feb 2003
Posts: 358
Topics: 4
Location: Israel

PostPosted: Tue Nov 04, 2003 2:38 am    Post subject: Reply with quote

H?

There is no Built-Ib function in REXX for replace.
I wrote my own function:
Code:

/* REXX */                                                     
                                                               
A = 'MY NAME IS OFER'                                           
SAY A                                                           
B = REPLACE(A,' OFER',' OFERICO')                               
SAY B                                                           
                                                               
EXIT                                                           
                                                               
REPLACE:                                                       
                                                               
RETSTRING  = ARG(1)                                             
ARG2LENGTH = LENGTH(ARG(2))                                     
                                                               
DO FOREVER                                                     
  LOOK4_POS = POS(ARG(2),RETSTRING)                             
  IF SUBSTR(RETSTRING,LOOK4_POS+ARG2LENGTH,1) ?= ' ' THEN LEAVE
  IF LOOK4_POS = 0 THEN LEAVE                                   
  RETSTRING  = SUBSTR(RETSTRING,1,LOOK4_POS-1)||,               
               ARG(3)||,                                       
               SUBSTR(RETSTRING,LOOK4_POS+ARG2LENGTH)           
END                                                             
                                                               
RETURN RETSTRING                                               
                                                                 


Attention: This function is "word sensitive".

HTH

O.
________
vaporizer shop


Last edited by ofer71 on Sat Feb 05, 2011 11:08 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail
uneasabe
Beginner


Joined: 26 Oct 2003
Posts: 8
Topics: 4
Location: Mumbai

PostPosted: Tue Nov 04, 2003 2:55 am    Post subject: Reply with quote

thanks a lot
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group