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 

Change the first occurance

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


Joined: 29 May 2007
Posts: 165
Topics: 77

PostPosted: Wed May 13, 2009 12:40 am    Post subject: Change the first occurance Reply with quote

Hi All,

I have a jobcard and i want to change last character of userid eg USER7 to USERA. Like this is i need to change a lot of jcl

Code:

//USER7 JOB (D328),FGVD71D,                     
//             CLASS=1,                     
//             MSGCLASS=X,                   
//             MSGLEVEL=(1,1)               



But when i run this macro it is changing all occurnaces of 7 to A . i want to change it only one time i.e first occurnace.Please help me in this

Code:

/* REXX */                             
 TRACE ?R                               
'ISREDIT MACRO'                         
'ISREDIT F "JOB" FIRST'                 
'ISREDIT (L1,C1) = CURSOR'             
IF L1=0001 THEN DO                     
'ISREDIT (L1) = LINE' L1               
REPLACE = SUBSTR(L1,3,1)               
SAY REPLACE                             
'ISREDIT CHANGE 'REPLACE' 'A''   
END                                     
 SAY "ZERRSM : " ZERRSM                 
 SAY "ZERRLM : " ZERRLM                 



Thanks,
Siva
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Wed May 13, 2009 5:22 am    Post subject: Reply with quote

you have the column and the line number of the character you want to change.
use chg p'=' 'A' col col line line.

that way you don't have to determine the character that you wish to change.

also, get into the habit of checking the rc after any invocation of a service.
not doing so is poor programming.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
expat
Intermediate


Joined: 01 Mar 2007
Posts: 475
Topics: 9
Location: Welsh Wales

PostPosted: Wed May 13, 2009 5:42 am    Post subject: Reply with quote

What is wrong with
Code:

"ISREDIT MACRO"
"ISREDIT C 'USER7' 'USERA' FIRST"
"ISREDIT END"

_________________
If it's true that we are here to help others,
then what exactly are the others here for ?
Back to top
View user's profile Send private message
Terry_Heinze
Supermod


Joined: 31 May 2004
Posts: 391
Topics: 4
Location: Richfield, MN, USA

PostPosted: Wed May 13, 2009 4:19 pm    Post subject: Reply with quote

I think you don't even need "FIRST" if you want to replace only 1 occurrence of the string, right?
_________________
....Terry
Back to top
View user's profile Send private message Send e-mail
expat
Intermediate


Joined: 01 Mar 2007
Posts: 475
Topics: 9
Location: Welsh Wales

PostPosted: Thu May 14, 2009 12:58 am    Post subject: Reply with quote

Terry_Heinze wrote:
I think you don't even need "FIRST" if you want to replace only 1 occurrence of the string, right?

Belt and braces (or suspenders to you cross pond guys) approach Laughing
_________________
If it's true that we are here to help others,
then what exactly are the others here for ?
Back to top
View user's profile Send private message
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