|
|
| Author |
Message |
enrico-sorichetti
Global Moderator
Joined: 14 Mar 2007 Posts: 3082 Location: italy
|
|
|
|
just repeat as many times as needed
| Code: |
1234567890123456
ISREDIT C '// MGMTCLAS=R2, ' '//* XXXTCLAS=R2, ' ALL
ISREDIT C '// MGMTCLAS=R2, ' '//* XXXTCLAS=R2, ' ALL
ISREDIT C '// MGMTCLAS=R2, ' '//* XXXTCLAS=R2, ' ALL
ISREDIT C '// MGMTCLAS=R2, ' '//* XXXTCLAS=R2, ' ALL
ISREDIT C '// MGMTCLAS=R2, ' '//* XXXTCLAS=R2, ' ALL
ISREDIT C '// MGMTCLAS=R2, ' '//* XXXTCLAS=R2, ' ALL
and so on |
[/quote] |
|
| Back to top |
|
 |
References
|
|
 |
dick scherrer
Global Moderator
Joined: 23 Nov 2006 Posts: 8643 Location: 221 B Baker St
|
|
|
|
Yup, that should do it
d |
|
| Back to top |
|
 |
chidams78 Currently Banned Active User
Joined: 29 May 2006 Posts: 59 Location: India
|
|
|
|
That is great...
Thanks Enrico.
I also thought of the logic (as told by Pedro) i.e., finding the MGMTCLAS=R2 by puting spaces on either sides and then deleting the entry from the PROC.
| Code: |
MGMTRC = 0
DO WHILE (MGMTRC = 0)
ISREDIT F ' MGMTCLAS=R2, ' "
MGMTRC = RC
IF MGMTRC = 0 THEN
DO
ISREDIT (LINE) = LINENUM .ZCSR
ISREDIT DELETE .ZCSR
END
ELSE DO
ISREDIT (LINE) = LINENUM .ZCSR
END
END |
The logic mentioned by Enrico also holds good in this case.
But both the logic fails if MGMTCLAS=R2 falls as the last parameter of DD STEP.
Thanks
Chidam |
|
| Back to top |
|
 |
dick scherrer
Global Moderator
Joined: 23 Nov 2006 Posts: 8643 Location: 221 B Baker St
|
|
|
|
Hello,
I believe you can make use of the "lack of" the trailing comma. If this is the last parameter of the DD, there will be no comma after the "R2".
While it would be less than elegant, you could use the lack of a comma following the R2 and pass the pds once to identify (what would hopefully be) the few members with the R2 at the end of the DD. These few could be changed manually and then your process should be good to go.
Like i mentioned - less than elegant, but would forego the need to write an entire parser just to do this one task. |
|
| Back to top |
|
 |
Pedro
Senior Member
Joined: 01 Sep 2006 Posts: 510 Location: work
|
|
|
|
Actually, I had said to find the one where it is last in the list (but I did not write it correctly in my sample code):
1. Find where it is last in list (blank before and after):
| Code: |
Address ISREDIT
"F ' MGMTCLAS=R2 ' "
|
Then back up and remove comma from previous line.
Delete the line you found.
| Code: |
"(line,col) =CURSOR"
"LABEL "line -1 "= .q 0"
"LABEL "line "= .r 0"
"CHANGE ', ' ' ' first .q .q"
"DELETE .r" |
NOTE: One of the examples used unquoted strings, such as
| Code: |
| ISREDIT (LINE) = LINENUM .ZCSR |
Instead of:
| Code: |
Address ISREDIT
"(LINE) = LINENUM .ZCSR" |
The rexx processor will try to resolve all of the text as variables. Someday you may actually have a 'linenum' variable and the macro will not work as you intended.
And even though they may function the same, they are not. Rexx looks for a variable called ISREDIT, looks for a variable called LINE, and looks for a variable called LINENUM. It will not find it the first time, so creates a variable and sets the value to its name (in uppercase). Finally, it resolves the whole command and sends it to ISREDIT. For a few variables, this extra processing is minuscule, but when many such commands are used, it adds up. Now that you know, please add quotes around your host commands. |
|
| Back to top |
|
 |
Ramya A
Active User
Joined: 26 Jul 2004 Posts: 104
|
|
|
|
You can do
| Code: |
DO i=1 to n
ISREDIT C ' MGMTCLAS=R2, ' 'MGMTCLAS=R2, ' ALL
END |
where n would be the maximum number of spaces you would expect between '//' and 'MGMTCLAS' in any of your JCL. This way, at end of this loop there will only be //MGMTCLAS and no spaces in between. |
|
| Back to top |
|
 |
Ramya A
Active User
Joined: 26 Jul 2004 Posts: 104
|
|
|
|
Oops! Sorry, didn't see the second page of replies..  |
|
| Back to top |
|
 |
chidams78 Currently Banned Active User
Joined: 29 May 2006 Posts: 59 Location: India
|
|
|
|
Thanks to all for this ISPF macro piece.
It worked. Now whichever way the MGMTCLAS=R2 is coded in the existing PROC, our ISPF macro finds it and cleans it off...:-) |
|
| Back to top |
|
 |
|
|