|
View previous topic :: View next topic
|
| Author |
Message |
asarolia
New User
Joined: 27 Mar 2008 Posts: 3 Location: Mumbai
|
|
|
|
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 |
|
 |
Pedro
Global Moderator

Joined: 01 Sep 2006 Posts: 2624 Location: Silicon Valley
|
|
|
|
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 |
|
 |
prino
Senior Member

Joined: 07 Feb 2009 Posts: 1325 Location: Vilnius, Lithuania
|
|
|
|
"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 |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
 |
don.leahy
Active Member
Joined: 06 Jul 2010 Posts: 767 Location: Whitby, ON, Canada
|
|
|
|
| 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 |
|
 |
asarolia
New User
Joined: 27 Mar 2008 Posts: 3 Location: Mumbai
|
|
|
|
Hmm.. thanks a lot .. renaming the member made it to work.  |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|