Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Need help on a rexx code

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
Niki

Active User


Joined: 20 Sep 2008
Posts: 102
Location: Bangalore

PostPosted: Wed Jan 05, 2011 3:33 pm    Post subject: Need help on a rexx code
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: 1703
Location: Australia

PostPosted: Wed Jan 05, 2011 4:07 pm    Post subject:
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: 102
Location: Bangalore

PostPosted: Wed Jan 05, 2011 4:34 pm    Post subject:
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    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Wed Jan 05, 2011 6:19 pm    Post subject:
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: 102
Location: Bangalore

PostPosted: Wed Jan 05, 2011 8:46 pm    Post subject:
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

Senior Member


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

PostPosted: Wed Jan 05, 2011 9:01 pm    Post subject: Reply to: Need help on a rexx code
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    Post subject:
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

Senior Member


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

PostPosted: Thu Jan 06, 2011 2:34 am    Post subject: Reply to: Need help on a rexx code
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    Post subject:
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

Senior Member


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

PostPosted: Thu Jan 06, 2011 7:05 am    Post subject: Reply to: Need help on a rexx code
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    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts PL/I code tuning/Performance improvement Virendra Shambharkar PL/I & Assembler 4 Mon Dec 05, 2016 11:57 am
No new posts What is the code in CLIST to enable t... jackzhang75 CLIST & REXX 1 Fri Dec 02, 2016 3:02 am
No new posts IDEAL - Code Retrieval yugendran CA Products 0 Fri Nov 25, 2016 3:27 pm
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 6 Fri Nov 18, 2016 1:48 pm
This topic is locked: you cannot edit posts or make replies. Rexx to create GDG by scanning JJ result krish.deepu CLIST & REXX 5 Tue Oct 25, 2016 5:32 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us