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

Resolving nested symbolic variables in an edit macro


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Wed Nov 13, 2013 8:24 am
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Wed Nov 13, 2013 12:32 pm
Reply with quote

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
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Wed Nov 13, 2013 5:54 pm
Reply with quote

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
View user's profile Send private message
don.leahy

Active Member


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

PostPosted: Wed Nov 13, 2013 7:01 pm
Reply with quote

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
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Wed Nov 13, 2013 8:44 pm
Reply with quote

After many more attempts, finally got it working. icon_smile.gif
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
View user's profile Send private message
Pedro

Global Moderator


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

PostPosted: Wed Nov 13, 2013 9:48 pm
Reply with quote

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 &ampersand 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
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 -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Query on edit primary command CLIST & REXX 5
No new posts Query on edit primary command CLIST & REXX 1
No new posts PRINTOUT macro PL/I & Assembler 0
No new posts Need help to resolve a hard edit COBOL Programming 8
This topic is locked: you cannot edit posts or make replies. Need help to resolve a hard edit COBOL Programming 4
Search our Forums:

Back to Top