View previous topic :: View next topic
|
Author |
Message |
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1248 Location: Richfield, MN, USA
|
|
|
|
I have the following edit macro:
Code: |
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
ISREDIT MACRO
SET ME=&&SYSUID
ISREDIT LINE_AFTER 0 = "//&SYSUID.XX JOB (YYY,ZZZ),+
'PROGRAMMER',"
ISREDIT LINE_AFTER 1 = "// CLASS=B," /* JOB
ISREDIT LINE_AFTER 2 = "// MSGCLASS=H," /* STATEMENT
ISREDIT LINE_AFTER 3 = "//* RESTART=XXXXXXXX," /* AND
ISREDIT LINE_AFTER 4 = "// TYPRUN=SCAN," /* PARAMETERS
ISREDIT LINE_AFTER 5 = "// NOTIFY=&ME"
ISREDIT LINE_AFTER 6 = "//*"
SET &ZEDSMSG = JOB STATEMENT INSERTED /* FILL SHORT MSG
SET &ZEDLMSG = A JOB STATEMENT HAS BEEN INSERTED AT THE BEGINNING +
OF THIS DATASET /* FILL LONG MSG
ISPEXEC SETMSG MSG(ISRZ000) /* DISPLAY SHORT MSG |
but am unable to get the NOTIFY value to resolve to NOTIFY=&SYSUID. I've tried every combination of single and double &s I can think of but all attempts have resulted in my TSO user ID instead of &SYSUID ending up in the NOTIFY line. I had this working many years ago but lost my original code so am trying to recreate it. I've read the Edit Macro manual and looked at the 5 examples but still can't get it to work. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
Hi Terry,
You can pass paramaters to macros
Code: |
"ISPEXEC EDIT DATASET('"UID".WORKUSER') MACRO(MACRES00) PARM(XXXX)" |
Code: |
"ISREDIT MACRO (XXXX)" |
And can use the variable name XXXX in the macro code
Another solution might be to use VPUT in the calling REXX or whatever and VGET in the macro
As a side question, what do you want SYSUID to resolve to, as I use that particular SYSVAR to get the TSO ID of a user
Code: |
SAY 'USER ID = ' SYSVAR(SYSUID) |
|
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1248 Location: Richfield, MN, USA
|
|
|
|
I intended for it to be NOTIFY=&SYSUID so anyone could use the macro asis and if someone else copied it to their own SYSPROC concatenated DD, they wouldn't need to change the NOTIFY parameter -- it would be ready to go asis. I thought that my old version of this edit macro resolved &&SYSUID to &SYSUID when executed. It seems that the scanner now keeps resolving multiple &s until ALL of them are resolved. This was an old edit macro I found in Mainframe Journal (back when it had that name). |
|
Back to top |
|
|
don.leahy
Active Member
Joined: 06 Jul 2010 Posts: 767 Location: Whitby, ON, Canada
|
|
|
|
I haven't written a CLIST is a long time (much prefer Rexx) but there is a built in string function that suppressed variable substitution.
&SYSNSUB(level, expression) If you set level = 0, it suppresses symbolic substitution within expression. |
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1248 Location: Richfield, MN, USA
|
|
|
|
After many more attempts, finally got it working.
Code: |
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
/* */
/* THJS - INSERT A JOB STATEMENT AT THE BEGINNING OF THE */
/* DATASET BEING EDITED. */
/* */
/* AUTHOR - MAINFRAME JOURNAL */
/* CREATED - 12/07/1989 */
/* CHANGED - 11/13/2013 */
/* */
ISREDIT MACRO
SET ME = &NRSTR(&&&&SYSUID)
ISREDIT LINE_AFTER 0 = "//&SYSUID.XX JOB (AAAAA,BBBB),+
'YOUR NAME'," /* <-- CHANGE THIS PARM
ISREDIT LINE_AFTER 1 = "// CLASS=B," /* JOB
ISREDIT LINE_AFTER 2 = "// MSGCLASS=H," /* STATEMENT
ISREDIT LINE_AFTER 3 = "//* RESTART=XXXXXXXX," /* AND
ISREDIT LINE_AFTER 4 = "// TYPRUN=SCAN," /* PARAMETERS
ISREDIT LINE_AFTER 5 = "// NOTIFY=&ME"
ISREDIT LINE_AFTER 6 = "//*"
SET &ZEDSMSG = JOB STATEMENT INSERTED /* FILL SHORT MSG
SET &ZEDLMSG = A JOB STATEMENT HAS BEEN INSERTED AT THE BEGINNING +
OF THIS DATASET /* FILL LONG MSG
ISPEXEC SETMSG MSG(ISRZ000) /* DISPLAY SHORT MSG |
I tried learning REXX to do this, but it seemed much simpler with an old-fashioned edit macro for this purpose. Thanks everyone for your help. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2596 Location: Silicon Valley
|
|
|
|
Quote: |
I tried learning REXX to do this, but it seemed much simpler with an old-fashioned edit macro for this purpose |
Rexx and edit macros are not mutually exclusive. You can write editor macros in rexx. Though, I think you will still have a similar problem of resolving ampersands. It is done by ISPF regardless of the language of the macro.
Whenever confronted with this &ersand issue, I use a different character in the macro statement, then change it to be the ampersand:
Code: |
/* rexx*/
Address ISREDIT
"MACRO"
"LINE_before 2 = < 1 '//~~SYSUID.X JOB ' >"
"C '~~' '&' " |
It works in the change statement because the quoted ampersand does not appear to be an actual variable. |
|
Back to top |
|
|
|