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

Need help on a rexx code


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

Active User


Joined: 20 Sep 2008
Posts: 106
Location: Bangalore

PostPosted: Wed Jan 05, 2011 3:33 pm
Reply with quote

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
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Wed Jan 05, 2011 4:07 pm
Reply with quote

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
View user's profile Send private message
Niki

Active User


Joined: 20 Sep 2008
Posts: 106
Location: Bangalore

PostPosted: Wed Jan 05, 2011 4:34 pm
Reply with quote

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
View user's profile Send private message
Jeffrey Ranney

New User


Joined: 23 Dec 2010
Posts: 20
Location: USA

PostPosted: Wed Jan 05, 2011 5:43 pm
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed Jan 05, 2011 6:19 pm
Reply with quote

Seek and ye shall find

Click here for some clues
Back to top
View user's profile Send private message
Niki

Active User


Joined: 20 Sep 2008
Posts: 106
Location: Bangalore

PostPosted: Wed Jan 05, 2011 8:46 pm
Reply with quote

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
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2547
Location: Silicon Valley

PostPosted: Wed Jan 05, 2011 9:01 pm
Reply with quote

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
View user's profile Send private message
Jeffrey Ranney

New User


Joined: 23 Dec 2010
Posts: 20
Location: USA

PostPosted: Wed Jan 05, 2011 9:05 pm
Reply with quote

/* 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
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2547
Location: Silicon Valley

PostPosted: Thu Jan 06, 2011 2:34 am
Reply with quote

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
View user's profile Send private message
Jeffrey Ranney

New User


Joined: 23 Dec 2010
Posts: 20
Location: USA

PostPosted: Thu Jan 06, 2011 3:11 am
Reply with quote

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
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2547
Location: Silicon Valley

PostPosted: Thu Jan 06, 2011 7:05 am
Reply with quote

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
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 Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
No new posts run rexx code with jcl CLIST & REXX 15
Search our Forums:

Back to Top