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

Not able to execute the ISREDIT MACRO, getting RC 20


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

New User


Joined: 27 Mar 2008
Posts: 3
Location: Mumbai

PostPosted: Thu Mar 29, 2012 7:23 pm
Reply with quote

Hi,

i just started working on edit macros, thus please bear if my query is silly one.

I have created few edit macros, which i am able to run in our system.
But below macro which i have written to edit the current dsn having the cobol code to expand the copybook is not working -

*************************************************************

Code:
/* REXX */                                                                                 
TRACE R                                                               
ADDRESS ISREDIT "MACRO"                                               
ADDRESS ISREDIT "(ROW,COL) = CURSOR"                                   
ADDRESS ISREDIT "(LINE) = LINENUM.ZCSR"                               
ADDRESS ISPEXEC CONTROL ERRORS RETURN                                 
CPYLIB = "NUTSO.SAROLIA.TEST"                           
LINE = SUBSTR(LINE,7,66)                                               
CMD = SUBWORD(LINE,1,1)                                               
CPY = SUBWORD(LINE,2,1)                                               
CMD = STRIP(CMD)                                                       
CPY = STRIP(CPY,'T','.')                                               
IF CMD \= 'COPY' OR CMD \= 'INCLUDE' THEN EXIT                         
ELSE CALL EXPAND_COPYBOOK                                             
                                                                       
EXPAND_COPYBOOK:                                                       
/* CHECK IF COPYBOOK EXISTS */                                         

DSN = CPYLIB || "("CPY")"                       
ADDRESS TSO                                     
RC = SYSDSN("'"DSN"'")                         
IF RC \= 'OK' THEN DO                           
  MSG = "COPYBOOK NOT FOUND:'" CPY "'"         
  ADDRESS ISREDIT "LINE_AFTER ROW'"MSG"'"       
  EXIT                                         
END                                             
                                               
/* READ COPYBOOK */                             
ADDRESS TSO                                     
"ALLOC FI(IFILE) DA('" || DSN || "') SHR"       
'EXECIO * DISKR IFILE (STEM BOOK.'             
'EXECIO 0 DISKR IFILE (FINIS'                   
'FREE F(IFILE)'                                 
ADDRESS ISREDIT                                 
                                               
/* PASTE COPYBOOK INTO PROGRAM SOURCE */           
J = 1                                             
DO UNTILL BOOK.J = ''                             
   MARK = '|++++|'                               
   TXT = SUBSTR(BOOK.J,7,66)                     
   ADDRESS ISREDIT "LINE_AFTER &ROW = '"TXT"'"   
   J = J + 1                                     
   ROW = ROW + 1                                 
END                                               
EXIT                                             

*************************************************************

Please note i have added the above code in member of correct library with name EXPAND, as i am able to run other macros.

But for above code when i give "EXPAND" on command line with cursor on "COPY COPYBOOKNAME" , it gives me error " command expand is not active "

And when i give "TSO EXPAND" it gives ne below error -

*-* ADDRESS ISREDIT "MACRO"
>>> "MACRO"
+++ RC(20) +++
*-* ADDRESS ISREDIT "(ROW,COL) = CURSOR"
>>> "(ROW,COL) = CURSOR"
+++ RC(20) +++
*-* ADDRESS ISREDIT "(LINE) = LINENUM.ZCSR"
>>> "(LINE) = LINENUM.ZCSR"
+++ RC(20) +++
*-* ADDRESS ISPEXEC CONTROL ERRORS RETURN
>>> "CONTROL ERRORS RETURN"
*-* CPYLIB = "ENDEVORD.PROD.GEXC.####.G.COPYLIB"
>>> "ENDEVORD.PROD.GEXC.####.G.COPYLIB"
*-* LINE = SUBSTR(LINE,7,66)
>>> "

*-* CMD = SUBWORD(LINE,1,1)
>>> ""
*-* CPY = SUBWORD(LINE,2,1)
>>> ""
*-* CMD = STRIP(CMD)
>>> ""
*-* CPY = STRIP(CPY,'T','.')

Please help.
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2547
Location: Silicon Valley

PostPosted: Thu Mar 29, 2012 8:05 pm
Reply with quote

EXPAND is an ISPF command, so it is a restricted name. Rename your program. It is as if you had named your program to be 'END' or 'CANCEL'... ISPF will recognize it and try to do it.

I do not believe there is a list of restricted names, but if you go to ISPF option 3.9 and list the ISP command table, you can see what command names not to use.
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1306
Location: Vilnius, Lithuania

PostPosted: Thu Mar 29, 2012 8:05 pm
Reply with quote

"Wij runderen, wij glunderen!"

Before you create an edit macro, it would be a good thing to press PF1 from the main ISPF menu, followed by "I" to look in the ISPF Tutorial Index if there is already a command with that name...
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Mar 29, 2012 8:12 pm
Reply with quote

Another way is to give your macro a name which is not the first one you think of.

EXPAND is asking for trouble. It is a single word. If not used now, it could well be used in a later release. EXPCPYBK is much better. Unlikely to be used in future by system software, much more mnemonic than "EXPAND".
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 765
Location: Whitby, ON, Canada

PostPosted: Thu Mar 29, 2012 11:45 pm
Reply with quote

LOOK and ZOOM are two other common names for this kind of function. There may already be one of them in your shop.
Back to top
View user's profile Send private message
asarolia

New User


Joined: 27 Mar 2008
Posts: 3
Location: Mumbai

PostPosted: Fri Mar 30, 2012 9:30 am
Reply with quote

Hmm.. thanks a lot .. renaming the member made it to work. icon_smile.gif
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 Execute secondary panel of sdsf with ... CLIST & REXX 1
No new posts Fetch data from programs execute (dat... DB2 3
No new posts PRINTOUT macro PL/I & Assembler 0
This topic is locked: you cannot edit posts or make replies. How To Write, Compile and Execute Cob... COBOL Programming 5
No new posts create rexx edit Macro that edits the... CLIST & REXX 3
Search our Forums:

Back to Top