Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
ISPF edit macro - Spacing out a variable issue
Goto page Previous  1, 2
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> TSO/ISPF
Author Message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 3082
Location: italy

PostPosted: Tue Aug 26, 2008 8:16 pm    Post subject: Reply to: ISPF edit macro - Spacing out a variable issue
Reply with quote

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

Global Moderator


Joined: 23 Nov 2006
Posts: 8643
Location: 221 B Baker St

PostPosted: Tue Aug 26, 2008 9:24 pm    Post subject: Reply to: ISPF edit macro - Spacing out a variable issue
Reply with quote

Yup, that should do it icon_smile.gif

d
Back to top
View user's profile Send private message
chidams78
Currently Banned

Active User


Joined: 29 May 2006
Posts: 59
Location: India

PostPosted: Wed Aug 27, 2008 12:32 am    Post subject:
Reply with quote

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

Global Moderator


Joined: 23 Nov 2006
Posts: 8643
Location: 221 B Baker St

PostPosted: Wed Aug 27, 2008 1:16 am    Post subject:
Reply with quote

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

Senior Member


Joined: 01 Sep 2006
Posts: 510
Location: work

PostPosted: Wed Aug 27, 2008 2:04 am    Post subject: Reply to: ISPF edit macro - Spacing out a variable issue
Reply with quote

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

Active User


Joined: 26 Jul 2004
Posts: 104

PostPosted: Wed Aug 27, 2008 2:19 am    Post subject:
Reply with quote

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

Active User


Joined: 26 Jul 2004
Posts: 104

PostPosted: Wed Aug 27, 2008 2:26 am    Post subject:
Reply with quote

Oops! Sorry, didn't see the second page of replies.. icon_sad.gif
Back to top
View user's profile Send private message
chidams78
Currently Banned

Active User


Joined: 29 May 2006
Posts: 59
Location: India

PostPosted: Wed Aug 27, 2008 2:31 am    Post subject:
Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> TSO/ISPF All times are GMT + 6 HoursGoto page Previous  1, 2
Page 2 of 2