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 macro command to find a line having given string.
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> TSO/ISPF
View previous topic :: :: View next topic  
Author Message
Rambhupalchowdary

New User


Joined: 19 Aug 2010
Posts: 47
Location: Hyderabad

PostPosted: Wed Apr 20, 2011 6:17 pm    Post subject: Need macro command to find a line having given string.
Reply with quote

Hi,

I need some help in doing below thing.

I want to find a line having given string. then i want to replace that particular line with the given data.

suppose.. :-

Code:


I/p :-

//Temp Job
//
//JOBLIB   DD  DSN=Prod.lib,DISP=SHR

O/p:-

//Temp Job
//
//JOBLIB   DD  DSN=test.lib,DISP=SHR
//             DD  DSN=prod.lib,DISP=SHR



please help me in doing this.
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 Apr 20, 2011 6:40 pm    Post subject:
Reply with quote

Many examples on the forum.

Search for rcx rcy with author expat and you will find
Back to top
View user's profile Send private message
Pedro

Senior Member


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

PostPosted: Wed Apr 20, 2011 6:45 pm    Post subject: Reply to: Need REXX macro command to find a line having give
Reply with quote

Use the FIND, CHANGE, and LINE_AFTER macro instructions.
Back to top
View user's profile Send private message
Rambhupalchowdary

New User


Joined: 19 Aug 2010
Posts: 47
Location: Hyderabad

PostPosted: Wed Apr 20, 2011 7:10 pm    Post subject:
Reply with quote

Hi,

I have looked into many examples, however am able to find how to replace strings.

Here i need to replace an entire line and insert 2 new lines as mentioned in my above code.

i am able to insert new lines at first line using below code.
ISREDIT LINE_BEFORE .ZFIRST = (LINE2),
but i need to insert 2 new lines where this string found, and delete the line having this string.

Please let me know your thoughts
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 645
Location: Pennsylvania

PostPosted: Wed Apr 20, 2011 7:25 pm    Post subject:
Reply with quote

You actually are changing one line and inserting one new line.

Use the commands Pedro suggested.

You are almost there.
Back to top
View user's profile Send private message
prino

Active Member


Joined: 07 Feb 2009
Posts: 985
Location: Oostende, Belgium

PostPosted: Wed Apr 20, 2011 8:30 pm    Post subject:
Reply with quote

Rambhupalchowdary wrote:
Please let me know your thoughts

They would be censored.
Back to top
View user's profile Send private message
Rambhupalchowdary

New User


Joined: 19 Aug 2010
Posts: 47
Location: Hyderabad

PostPosted: Wed Apr 20, 2011 9:52 pm    Post subject:
Reply with quote

Hi Daveporcelan,

I have tried those line commands.

I am able to insert the lines at first or second line in my jcl. But i am unable to insert the line at line number, having the given string.

EG:- for your ref. please find the sample output which i am expecting in my previous post.

Thanks,
Ram.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 645
Location: Pennsylvania

PostPosted: Wed Apr 20, 2011 9:54 pm    Post subject:
Reply with quote

Why not post your entire macro?

That would provide the best possible information to work with.
Back to top
View user's profile Send private message
Peter Nancollis

New User


Joined: 15 Mar 2011
Posts: 47
Location: UK

PostPosted: Thu Apr 21, 2011 7:01 am    Post subject:
Reply with quote

"Use the FIND, CHANGE, and LINE_AFTER macro instructions. " ...and they dont work [ and I must say they would have been the first things I would try ] ... why/how not?.......or do you just want the macro coding?
Back to top
View user's profile Send private message
Rambhupalchowdary

New User


Joined: 19 Aug 2010
Posts: 47
Location: Hyderabad

PostPosted: Thu Apr 21, 2011 11:09 am    Post subject:
Reply with quote

Hi Daveporcelan,

Could you please find the below code for my requirement.

<Code>
ADDRESS ISREDIT
"ISREDIT MACRO (MEM) NOPROCESS"
ISREDIT CHANGE 'Prod.lib' 'Test.lib' ALL
<\Code>

With the above code am able to acheive as below mentioned output

I/p :-

//Temp Job
//
//JOBLIB DD DSN=Prod.lib,DISP=SHR

O/p:-

//Temp Job
//
//JOBLIB DD DSN=test.lib,DISP=SHR

I want to get the output like below .
O/p:-

//Temp Job
//
//JOBLIB DD DSN=test.lib,DISP=SHR
// DD DSN=prod.lib,DISP=SHR

How to acheive this, i tried to insert new line at starting.but how to insert that new line immediately after the joblib.

Thanks,
Ram.
Back to top
View user's profile Send private message
prino

Active Member


Joined: 07 Feb 2009
Posts: 985
Location: Oostende, Belgium

PostPosted: Thu Apr 21, 2011 11:58 am    Post subject:
Reply with quote

Maybe you could finally RTFM?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Apr 21, 2011 12:18 pm    Post subject:
Reply with quote

Rambhupalchowdary,

the char used in BBcode is [ and not <.

globally changing prod.lib to test.lib precludes your finding the point at which to insert the extra dd statement.

if you would loop
Code:

SET RC = 0
DO WHILE RC = 0
   'CHG NEXT "PROD.LIB" "TEST.LIB"
    IF RC= 0 THEN
        (insert prod.lib dd after .zcsr)
        IF RC<>0 THEN
            DO
                SAY 'insert not ok at last chg'
                LEAVE
            END
END


you could find the places to insert the extra dd statement.
Back to top
View user's profile Send private message
Rambhupalchowdary

New User


Joined: 19 Aug 2010
Posts: 47
Location: Hyderabad

PostPosted: Thu Apr 21, 2011 12:18 pm    Post subject:
Reply with quote

Hi Prino,

What is RTFM? I searched for this term i could not able to find.

Please let me know.
Back to top
View user's profile Send private message
prino

Active Member


Joined: 07 Feb 2009
Posts: 985
Location: Oostende, Belgium

PostPosted: Thu Apr 21, 2011 12:33 pm    Post subject:
Reply with quote

Rambhupalchowdary wrote:
What is RTFM? I searched for this term i could not able to find.
What do you do in IT?

Maybe use Google? Or you also don't know what Google is?

It the returns this website as the third result.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7241

PostPosted: Thu Apr 21, 2011 12:35 pm    Post subject:
Reply with quote

I thought can't be true, and lo, first result from google, wikipedia. If you are looking for help, don't jerk people around.
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: Thu Apr 21, 2011 12:53 pm    Post subject:
Reply with quote

RTFM = Read The Fine (or orther words starting with F) Manual

Did you read the topic I suggested you read, even gave you a link to it. It does exactly what it says it does on the tin. It inserts a line / member after a given point within the data.

Now either go read that thread or something similar or RTFM icon_rolleyes.gif
Back to top
View user's profile Send private message
Rambhupalchowdary

New User


Joined: 19 Aug 2010
Posts: 47
Location: Hyderabad

PostPosted: Thu Apr 21, 2011 1:04 pm    Post subject:
Reply with quote

Thanks DbzTHEdinosauer,

I tried few of the commands mentioned in your above code. EG:-ZCSR

Now i got the output what i was expecting.

ISREDIT CHANGE 'DSN=S00P.BT.PGMLIB,' 'DSN=BDLE.BT.PGMLIB,'
IF RC=0 THEN
DO
LINE1 = "// DD DSN=S00P.BT.PGMLIB,DISP=SHR"
"ISREDIT LINE_AFTER .ZCSR = (LINE1)"
END

Thanks all for your inputs.. icon_smile.gif
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Apr 21, 2011 1:21 pm    Post subject:
Reply with quote

Rambhupalchowdary,

I am happy to see you were able to implement my suggestion and solve your problem.

BUT
I noticed that you do not check the return-code from the service call.

to write professional code/scripts, one should always insure that a call to a service,
whether it be an ISPF/SQL/File I-O/Language Environment,
be followed by a check of the return-code of that service.
Without doing so, you have no idea if the requested function/service performed as expected/wanted.

The difference between writing good code and BSing with the boys,
is being exact.

most good professionals that I know,
have private libraries of JCL/code/Scripts that they carry with them
(zipped and transferred via email)
from site to site,
which contain professionally written examples that can be easily and quickly copied and pasted.

with the innovation of CUT&PASTE (mainframe clipboard) professionally coding in ISPF has become very easy.
Back to top
View user's profile Send private message
Peter Nancollis

New User


Joined: 15 Mar 2011
Posts: 47
Location: UK

PostPosted: Fri Apr 22, 2011 1:49 am    Post subject:
Reply with quote

Quote:
have private libraries of JCL/code/Scripts that they carry with them

XMIT the PDS, drop the file to PC/Memory stick/whatever + use the wonderful XmitManager
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Apr 22, 2011 2:57 am    Post subject:
Reply with quote

Quote:
PC/Memory stick/whatever


i mentioned the email because that is about the only way I can get things from the outside to my pc at work, where ever that happens to be on a particular day.
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 -> TSO/ISPF All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to find the first monday of the w... abdulrafi COBOL Programming 10 Fri Nov 25, 2016 3:24 pm
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 6 Fri Nov 18, 2016 1:48 pm
No new posts Find out a active PGM jpsager JCL & VSAM 10 Fri Oct 07, 2016 4:32 pm
This topic is locked: you cannot edit posts or make replies. Checking wether a string starts from ... sundaram.naveen CLIST & REXX 9 Thu Oct 06, 2016 11:56 am
No new posts SDSF Command Avtrix CLIST & REXX 4 Fri Sep 30, 2016 11:13 am


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