View previous topic :: View next topic
|
Author |
Message |
Rambhupalchowdary
New User
Joined: 19 Aug 2010 Posts: 47 Location: Hyderabad
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
Many examples on the forum.
Search for rcx rcy with author expat and you will find |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2593 Location: Silicon Valley
|
|
|
|
Use the FIND, CHANGE, and LINE_AFTER macro instructions. |
|
Back to top |
|
|
Rambhupalchowdary
New User
Joined: 19 Aug 2010 Posts: 47 Location: Hyderabad
|
|
|
|
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 |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
You actually are changing one line and inserting one new line.
Use the commands Pedro suggested.
You are almost there. |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1314 Location: Vilnius, Lithuania
|
|
|
|
Rambhupalchowdary wrote: |
Please let me know your thoughts |
They would be censored. |
|
Back to top |
|
|
Rambhupalchowdary
New User
Joined: 19 Aug 2010 Posts: 47 Location: Hyderabad
|
|
|
|
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 |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
Why not post your entire macro?
That would provide the best possible information to work with. |
|
Back to top |
|
|
Peter Nancollis
New User
Joined: 15 Mar 2011 Posts: 47 Location: UK
|
|
|
|
"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 |
|
|
Rambhupalchowdary
New User
Joined: 19 Aug 2010 Posts: 47 Location: Hyderabad
|
|
|
|
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 |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1314 Location: Vilnius, Lithuania
|
|
|
|
Maybe you could finally RTFM? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
Rambhupalchowdary
New User
Joined: 19 Aug 2010 Posts: 47 Location: Hyderabad
|
|
|
|
Hi Prino,
What is RTFM? I searched for this term i could not able to find.
Please let me know. |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1314 Location: Vilnius, Lithuania
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
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 |
|
Back to top |
|
|
Rambhupalchowdary
New User
Joined: 19 Aug 2010 Posts: 47 Location: Hyderabad
|
|
|
|
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.. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
Peter Nancollis
New User
Joined: 15 Mar 2011 Posts: 47 Location: UK
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1314 Location: Vilnius, Lithuania
|
|
|
|
Peter Nancollis wrote: |
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 |
XmitManager is good, but for straight run-of-the-mill extractions RECV390 is much better (strips sequence numbers and trailing blanks) and using it with the "-dsattr -write" options writes out the PDS directory, which, with a little reformatting, can be used to set the dates of the extracted members to the ones in the original PDS, using e.g. Touch32. (Sadly RECV390 cannot handle PS data sets ) And at less than 40K RECV390 is about one-twenty-fifth of the size of of XmitManager. |
|
Back to top |
|
|
|