|
|||||||||||
|
Chicago-Soft
|
Quick Tip - Using the IMAC Variable by James Van Sickle A nice feature of ISPF EDIT is the ability to specify an initial edit macro. Such a macro could be executed each time you invoke edit via =2 to perform special tasks to customize your edit session. For example, it could override built-in functions you may have redesigned or enhanced, it could examine the name of the dataset you're editing to check if it's production and turn autosave off (keeps the security administrators off your back!), or maybe display the ISPF member statistics (the one I use does all of the above and then some). Only problem is, when you specify an inital edit macro on the =2 panel, it isn't saved anywhere, so you have to rekey it every time. However, with a little digging, I discovered that there IS a profile variable called IMAC which is interrogated when going to =2. Set IMAC in your ISPF profile (using =7.3 or ISPEXEC VPUT) to the name of your macro, and it will show up on the =2 panel everytime. If you don't wish to use this 'default' edit macro for a particular edit session, you can just clear the field or type over it. The IMAC variable can also be used when invoking edit from execs or clists. And, by using the following syntax, there's no need to retrieve and/or verify the existance of the variable explicitly¯if it's there, it's used, and if it's not, the parameter is simply ignored: ISPEXEC EDIT DATASET(your.dataset.name) MACRO(&IMAC) Edit profiles are useful for doing things like adjusting nulls, tabs, caps, etc, but they are limited in that they're restricted to keying off the last node of a dataset name. You could specify an intial edit macro in the edit profile as well, but you'd have to do so every time you created a dataset with a new low level qualifier. This would also be a problem if you decided to impliment a shop-standard initial edit macro, or if you decided at some point to change the macro name. By using the IMAC variable, you'd never have to worry about it again. (There is one restriction, though: IMAC isn't used when invoking edit from =3.1 or =3.4). A simple default edit macro might look like this: Download this exec in text format (SP96QT1-IMAC.TXT)
/* REXX */
/* Default Edit Macro 'MYMACRO' */
trace N
"ISPEXEC CONTROL ERRORS RETURN"
/* Override built in functions with homegrown macros */
"ISREDIT DEFINE BNDS MACRO CMD"
"ISREDIT DEFINE EDIT MACRO CMD"
/* Set Model Class based on DSN */
"ISREDIT (DSN)=DATASET"
parse value reverse(dsn) WITH lastnode "." .
lastnode=reverse(lastnode)
select
when lastnode="ISPCLIB"
then do
"ISREDIT (CARD)=LINE .ZF"
if rc=0 & find(card," REXX ")=0 then "ISREDIT MODEL CLASS CLIST" else "ISREDIT MODEL CLASS REXX"
end
when lastnode="ISPPLIB"
then "ISREDIT MODEL CLASS PANELS"
when lastnode="ISPSLIB"
then "ISREDIT MODEL CLASS SKELS"
when lastnode="ISPMLIB"
then "ISREDIT MODEL CLASS MSGS"
otherwise nop
end
/* Show the ISPF statistics */
"ISREDIT (MBR)=MEMBER"
if mbr=""
then exit
zlmdate=""
"ISPEXEC LMINIT DATAID(DATAID) DATASET('"dsn"') ENQ(SHR)"
"ISPEXEC LMOPEN DATAID("dataid") OPTION(INPUT)"
"ISPEXEC LMMFIND DATAID("dataid") MEMBER("mbr") STATS(YES)"
if zlmdate=""
then zedlmsg="No stats exist for this member"
else do
parse var zlmdate yy 3 4 mm 6 7 dd
mdate=mm"/"dd"/"yy
parse var zlcdate yy 3 4 mm 6 7 dd
cdate=mm"/"dd"/"yy
zedlmsg="Last Modified "mdate" at "zlmtime" by "zluser, " (Created "cdate", "strip(zlcnorc)" lines)"
end
zedsmsg=""
"ISPEXEC LMFREE DATAID("dataid")"
"ISPEXEC SETMSG MSG(ISRZ000)"
exit
Command:
James Van Sickle, United Retail Group, Inc., Rochelle Park, New Jersey.
|
|
||||||||
home · current
articles
· archives · forums · |