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
 

 

ISPF Edit Macro code not working

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> TSO/ISPF
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    Post subject: ISPF Edit Macro code not working
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10274
Location: italy

PostPosted: Wed Jun 08, 2011 8:01 pm    Post subject: Reply to: REXX code not working
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    Post subject: REXX code not working
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10274
Location: italy

PostPosted: Wed Jun 08, 2011 8:32 pm    Post subject: Reply to: REXX code not working
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: 8593
Location: Back in jolly old England

PostPosted: Wed Jun 08, 2011 10:22 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> TSO/ISPF All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts UNIT=AFF for Easytrieve code gandikk JCL & VSAM 7 Wed Jul 12, 2017 11:42 pm
No new posts Restart=Step not working ALAK SAHA JCL & VSAM 6 Fri Jun 30, 2017 6:28 pm
No new posts DB2 Program abending without giving a... rahulgarg14 DB2 7 Mon May 29, 2017 8:10 pm
No new posts Job failing with USER = 4093 REASON C... Pradeepa S ABENDS & Debugging 1 Wed May 17, 2017 3:35 pm
No new posts COBOL Code Parsers and Lineage Establ... balimanja COBOL Programming 2 Tue May 02, 2017 3:30 am


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