IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

ISPF Edit Macro code not working


IBM Mainframe Forums -> TSO/ISPF
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
harinair_kn
Warnings : 2

New User


Joined: 27 Feb 2006
Posts: 16
Location: India

PostPosted: Wed Jun 08, 2011 7:49 pm
Reply with quote

Hi

I was creating a tool to comment the lines of code within a range. The logic to comment the lines of code are working fine but the changes are not getting reflected. Can somebody help me ? Here is the code.


Code:
 /* REXX - THIS MACRO WILL COMMENT THE LINES YOU ARE SPECIFYING */   
  ADDRESS ISREDIT "MACRO NOPROCESS"                                   
  ADDRESS ISREDIT "PROCESS RANGE C"                                   
    IF RC=0 THEN                                                     
    DO                                                               
     "ISREDIT (FIRST) = LINENUM .ZFRANGE"                             
     "ISREDIT (LAST)  = LINENUM .ZLRANGE"                             
       DO WHILE FIRST <= LAST                                         
         "ISREDIT (L11) = LINE" FIRST                                 
         "ISREDIT (LI)  = LINE" FIRST                                 
         CH0 = SUBSTR(LI,3)                                           
         CH1 = SUBSTR(LI,1,1)                                         
         CH2 = SUBSTR(LI,1,2)                                         
                                                                     
           IF CH1 <> '/' THEN                                         
             DO                                                       
               LI = "//*" || LI                                       
               "ISREDIT CURSOR = " FIRST 1                           
               "ISREDIT CHANGE '"L11"' '"LI"' .ZCSR .ZCSR"           
               SAY L11                                               
               SAY LI                                               
             END                                                     
                                                                     
           IF CH2='/*' THEN                                         
             DO                                                     
               LI = "//*" || CH0                                     
               "ISREDIT CURSOR = " FIRST 1                           
               "ISREDIT CHANGE '"L11"' '"LI"' .ZCSR .ZCSR"           
               SAY L11                                               
               SAY LI                                               
             END                                                     
                                                                     
           IF CH2='//' THEN                                         
             DO                                                     
               LI = "//*" || CH0                                     
               "ISREDIT CURSOR = " FIRST 1                           
               "ISREDIT CHANGE '"L11"' '"LI"' .ZCSR .ZCSR"       
               SAY L11                                           
               SAY LI                                             
             END                                                 
         FIRST = FIRST + 1                                       
       END                                                       
    END

edited to add the CODE tags for better readability
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Jun 08, 2011 8:01 pm
Reply with quote

Quote:
The logic to comment the lines of code are working fine but the changes are not getting reflected.
icon_question.gif icon_eek.gif

clarify better, You do not expect really that somebody is going to take Your script and run it to discover what You did not care to tell ???
Back to top
View user's profile Send private message
harinair_kn
Warnings : 2

New User


Joined: 27 Feb 2006
Posts: 16
Location: India

PostPosted: Wed Jun 08, 2011 8:05 pm
Reply with quote

I am Sorry Ernico.
I am facing issues with the below line of code. But this code is not giving any errors as such but the changes are not reflecting.

"ISREDIT CHANGE '"L11"' '"LI"' .ZCSR .ZCSR"
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Jun 08, 2011 8:32 pm
Reply with quote

why go thru the CHANGE hassle

Code:
000030 do ln = first to last
000031    Address ISREDIT "(buff) = LINE "ln
000032    buff = strip(buff,"T")
000033    say ">>>" || buff || "<<<"
000034    buff = "/*" || buff || "*/"
000035    Address ISREDIT "LINE "ln" = (buff) "
000036 end


tested and working
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed Jun 08, 2011 10:22 pm
Reply with quote

Alternatively, I tend to use a method of wrapping IF/THEN/ENDIF around the steps that I do not wish to execute

/Good mood on
Code:

/* REXX *** SETS SELECTED STEPS TO NOT BE PROCESSED - BOUNDS = N NN  */
"ISREDIT MACRO NOPROCESS"
"ISPEXEC CONTROL ERRORS RETURN"
TOC   = 60
BEGIF = "//NORUN    IF (SETCOND.RC GT 0) THEN    < < < < < < < < < < <"
ENDIF = "//NORUN    ENDIF                        < < < < < < < < < < <"
IFPGM = "//SETCOND  EXEC PGM=IEFBR14             * * * * * * * * * * *"
"ISREDIT PROCESS RANGE N"
"ISREDIT (FRL) = "LINENUM .ZFRANGE
"ISREDIT (TOL) = "LINENUM .ZLRANGE
DO FOREVER
  "ISREDIT (WRKLINE) = LINE "FRL
  IF POS('EXEC',WRKLINE) > 0
     THEN  LEAVE
     ELSE  FRL = FRL - 1
  IF FRL = 0 THEN EXIT
END
"ISREDIT CURSOR = (TOL,TOC)"
"ISREDIT F 'EXEC' NEXT"
IF RC = 0 THEN DO
  "ISREDIT (TOL) = CURSOR"
  "ISREDIT LINE_BEFORE " TOL " = (ENDIF)"
END
ELSE DO
  "ISREDIT (WRKLINE) = LINE ".ZL
  IF LEFT(WRKLINE,22) = "//                    "
     THEN  "ISREDIT LINE_BEFORE " .ZL " = (ENDIF)"
     ELSE  "ISREDIT LINE_AFTER  " .ZL " = (ENDIF)"
END
"ISREDIT LINE_BEFORE " FRL " = (BEGIF)"
"ISREDIT F '//SETCOND  EXEC PGM=IEFBR14' FIRST"
IF RC <> 0 THEN DO
  "ISREDIT F 'SETCOND.RC' FIRST"
  "ISREDIT (FRL) = CURSOR"
  "ISREDIT F 'EXEC' FIRST"
  "ISREDIT (TOL) = CURSOR"
  IF TOL > FRL
     THEN  "ISREDIT LINE_BEFORE " FRL " = (IFPGM)"
     ELSE  "ISREDIT LINE_BEFORE " TOL " = (IFPGM)"
END
EXIT (1)
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> TSO/ISPF

 


Similar Topics
Topic Forum Replies
No new posts run rexx code with jcl CLIST & REXX 15
No new posts Compile rexx code with jcl CLIST & REXX 6
No new posts Looking for a little history of ISPF ... TSO/ISPF 5
No new posts Adding QMF and SPUFI to the ISPF menu DB2 20
No new posts PD not working for unsigned packed JO... DFSORT/ICETOOL 5
Search our Forums:

Back to Top