View previous topic :: View next topic
|
Author |
Message |
Niki
Active User
Joined: 20 Sep 2008 Posts: 106 Location: Bangalore
|
|
|
|
I do have some requirement in REXX. Could u please help me on that. The requirement is two insert few lines in all the members present in the PDS. The requirement is as below,
1) I have a PDS which contains 100 members.
2) I need to pass the PDS name through the rexx program and it shall do the below things,
a) It ll get each member (Contains a JCL) one by one.
b) Then it ll search in the JCL for a string (for e.g - EXEC PROC1) and then it need to insert two lines below that.
The sample code looks of the jcl looks like below,
//step01 EXEC PROC1,
// JOB01=XXXXXX,
// MEM01=YYYYYY,
So after the tools run the JCL should look like below,
//step01 EXEC PROC1,
// STEP01=PPPPPP,
// STEP2=MMMMM,
// JOB01=XXXXXX
// MEM01=YYYYYY
c) We can have a multiple PROC1 step or some other step calling some different proc also in the single JCL.
Can anyone please share across any sample code.
Thanks in advance. |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi Niki,
if you are inserting 2 lines after each PROC1, how did the commas disappear for
Code: |
// JOB01=XXXXXX,
// MEM01=YYYYYY,
|
I know this is not exactly answering the question.
Gerry |
|
Back to top |
|
|
Niki
Active User
Joined: 20 Sep 2008 Posts: 106 Location: Bangalore
|
|
|
|
Hi Gerry,
Sorry for the confusion.
The output should contain the commas and the below lines as per the JCL.
We are not going to change any other detail in the JCL's apart from adding the two lines after each search of the string.
Code: |
//step01 EXEC PROC1,
// STEP01=PPPPPP,
// STEP2=MMMMM,
// JOB01=XXXXXX,
// MEM01=YYYYYY,
|
|
|
Back to top |
|
|
Jeffrey Ranney
New User
Joined: 23 Dec 2010 Posts: 20 Location: USA
|
|
|
|
Niki -
I understand this is a HELP forum, not a write-my-code-for-me forum. What is your question regarding REXX ? |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
Back to top |
|
|
Niki
Active User
Joined: 20 Sep 2008 Posts: 106 Location: Bangalore
|
|
|
|
Hi ,
@Expat
Thanks for the reply.
I wrote the macro to insert the two lines after the string is getting searched. And the code looks like below,
Code: |
/* REXX */
"isredit macro"
linei = "// step01=pppppp,"
linep = "// step2=mmmmm,"
"isredit f '"exec proc1"'"
"isredit (line1) = line .zcsr"
"isredit line_after .zcsr = (linei)"
"isredit line_after .zcsr = (linep)"
"isredit save"
"isredit end"
|
But the problem here i m facing is if my input to this macro contains more the stringexec proc1 more than one time then it was not able to update for the seconnnd time.
I am able to get only for the first occurance of the string.
Can anyone please help me how to make it done for all the occurance of the string. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
check the return code from the FIND command and only do the inserts if the the text was found. And the do find again until not found condition. |
|
Back to top |
|
|
Jeffrey Ranney
New User
Joined: 23 Dec 2010 Posts: 20 Location: USA
|
|
|
|
/* REXX */
"isredit macro"
linei = "// step01=pppppp,"
linep = "// step2=mmmmm,"
"isredit f '"exec proc1"'"
find_rc = rc
do while find_rc = 0
"isredit (line1) = line .zcsr"
"isredit line_after .zcsr = (linei)"
"isredit line_after .zcsr = (linep)"
"isredit save"
"isredit end"
"isredit f '"exec proc1"'"
find_rc = rc
end |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
Jeffrey, I think your "isredit end" is out of place. Likely, also the "isredit save". Because you end the editor session, subsequent edit macro instructions will fail. |
|
Back to top |
|
|
Jeffrey Ranney
New User
Joined: 23 Dec 2010 Posts: 20 Location: USA
|
|
|
|
Pardon my original QUICK reply !! This code will work.. Thanks Pedro !!
/* REXX */
"isredit macro"
linei = "// step01=pppppp,"
linep = "// step2=mmmmm,"
"isredit f '"exec proc1"'"
find_rc = rc
do while find_rc = 0
"isredit (line1) = line .zcsr"
"isredit line_after .zcsr = (linei)"
"isredit line_after .zcsr = (linep)"
"isredit f '"exec proc1"'"
find_rc = rc
end
"isredit save"
"isredit end" |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
Niki, about:
Code: |
"isredit (line1) = line .zcsr"
"isredit line_after .zcsr = (linei)"
"isredit line_after .zcsr = (linep)" |
Sorry to nitpick.
I think the first line is unnecessary. The last two are out of order, per the original requirements. |
|
Back to top |
|
|
|