View previous topic :: View next topic |
Author |
Message |
sivafdms Intermediate
Joined: 29 May 2007 Posts: 165 Topics: 77
|
Posted: Wed May 13, 2009 12:40 am Post subject: Change the first occurance |
|
|
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 |
|
|
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Wed May 13, 2009 5:22 am Post subject: |
|
|
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 |
|
|
expat Intermediate
Joined: 01 Mar 2007 Posts: 475 Topics: 9 Location: Welsh Wales
|
Posted: Wed May 13, 2009 5:42 am Post subject: |
|
|
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 |
|
|
Terry_Heinze Supermod
Joined: 31 May 2004 Posts: 391 Topics: 4 Location: Richfield, MN, USA
|
Posted: Wed May 13, 2009 4:19 pm Post subject: |
|
|
I think you don't even need "FIRST" if you want to replace only 1 occurrence of the string, right? _________________ ....Terry |
|
Back to top |
|
|
expat Intermediate
Joined: 01 Mar 2007 Posts: 475 Topics: 9 Location: Welsh Wales
|
Posted: Thu May 14, 2009 12:58 am Post subject: |
|
|
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 _________________ If it's true that we are here to help others,
then what exactly are the others here for ? |
|
Back to top |
|
|
|
|