Page 2 of 2

Re: EditMacro "ISREDIT END" does not close Member/PS-Dataset

PostPosted: Fri Oct 05, 2012 4:05 am
by prino
steinef wrote:Well what I want to do is to change the panel.

I have two panels for ISREDDE4. One is the usual one that everyone knows and the second one has an extended command line over two lines. I want to be able to enable the second panel if required and disable if no longer needed.

Holy fluck, what an imbecile idea. Don't you know that ISPF caches panels?

If you need a long command line, why not let the macro display a pop-up where you can enter your commands, which are subsequently executed by said macro?

Re: EditMacro "ISREDIT END" does not close Member/PS-Dataset

PostPosted: Wed Nov 28, 2012 7:13 pm
by steinef
Hi guys (and gals),

I am deeply sorry for my late response, but this macro is like a pet to.

Now I am happy to present a working edit macro, which does exactly what I wanted to.

Please feel free to use it. If you have any questions, don't hesitate.


/* REXX *****************************************/
/* ------------------------------------------------------*/
/* Name:       LINE                                                   */
/* Short:      Initial Macro                                          */
/* Typ:        REXX-Macro                                             */
/* Function:   Turns a second command line on or off                  */
/*             Needs Macro MCANCEL and a predefined paneld (SCLINE)   */
/*             which has e second command line in the editor.         */
/*             The Member SCLINE must be in the USER.PANELS Dataset   */
/*             which must be preallocated.                            */
/*                                                                    */
/* Parameters: on or off                                              */
/*                                                                    */
/*******************************************************/

"ISREDIT MACRO (parm) NOPROCESS"

/* Check if correct parms are used ************ */
  IF parm = '' THEN DO
    zedsmsg = 'Macro Error'
    zedlmsg = 'Parameter ist missing. Must be on or off'
    "ISPEXEC SETMSG MSG(isrz000)"
    EXIT
  END

  IF parm /= 'on' THEN DO
  IF parm /= 'off' THEN DO
    zedsmsg = 'Macro Error'
    zedlmsg = 'Macro parameter must be on or off.'
    "ISPEXEC SETMSG MSG(isrz000)"
    EXIT
  END
  END

/* Define Variables *************************** */
"ISREDIT (dsn) = DATASET"
"ISREDIT (mem) = MEMBER"

IF mem /= "" THEN
dsn = dsn!!"("!!mem!!")"

tempcmd = "SCRNAME TMP PERM"
tmpvar = "7`X`X`swap tmp"   /* ` -> is the command delimiter */

"ISPEXEC VGET ZPANELID"
panelid = ZPANELID

/* Beginn of the macro ************************ */

"ISREDIT BUILTIN SAVE"

"ISPEXEC DISPLAY COMMAND(tempcmd)"

/* Second line activation ********************* */
IF parm="on" THEN DO
  IF SYSDSN("'"USERID()".USER.PANELS(SCLINE)'")<>'OK' THEN DO
    zedsmsg = 'Macro Error'
    zedlmsg = 'Second command line allready in use.'
    "ISPEXEC SETMSG MSG(isrz000)"
    EXIT
  END

  "ISREDIT CANCEL"
  "TSO RENAME '"USERID()".USER.PANELS(SCLINE)',
   '"USERID()".USER.PANELS("panelid")'"
     "ISPEXEC CONTROL NONDISPL END"
     "ISPEXEC SELECT PGM(ISPSTRT) SCRNAME(TEMP) PARM("tmpvar")"
  "ISPEXEC VIEW DATASET('"dsn"') MACRO(MCANCEL)"
END

/* Second line deactivation ******************* */
IF parm="off" THEN DO
  IF SYSDSN("'"USERID()".USER.PANELS("panelid")'")<>'OK' THEN DO
    zedsmsg = 'Macro Error'
    zedlmsg = 'Second command line allready off.'
    "ISPEXEC SETMSG MSG(isrz000)"
    EXIT
  END
  "ISREDIT CANCEL"
  "TSO RENAME '"USERID()".USER.PANELS("panelid")',
   '"USERID()".USER.PANELS(SCLINE)'"
     "ISPEXEC CONTROL NONDISPL END"
     "ISPEXEC SELECT PGM(ISPSTRT) SCRNAME(TEMP) PARM("tmpvar")"
  "ISPEXEC VIEW DATASET('"dsn"') MACRO(MCANCEL)"
END                              /* Macro MCANCEL closes the Dataset  */
                                 /* by issuing ISREDIT CANCEL as only */
"ISREDIT CANCEL"                 /* statement.                        */

/* Macro successfully completed *************** */
zedsmsg = 'Macro complete'
zedlmsg = 'Macro successfully completed.'
"ISPEXEC SETMSG MSG(isrz000)"

EXIT


Code'd

Re: EditMacro "ISREDIT END" does not close Member/PS-Dataset

PostPosted: Wed Nov 28, 2012 7:31 pm
by BillyBoyo
If you like it, you should at least take the time to present it well, in the Code tags and using the Preview button to get it looking its best here. I've done some of it, but I'm not going to change the rest which doesn't "fit" into the display box. If you'd like to post a formatted version, it would be good.

Re: EditMacro "ISREDIT END" does not close Member/PS-Dataset

PostPosted: Thu Nov 29, 2012 5:11 am
by Pedro
I do not understand the renaming... why not just specify the second panel name:
"ISPEXEC VIEW DATASET('"dsn"') PANEL(SCLINE)

Re: EditMacro "ISREDIT END" does not close Member/PS-Dataset

PostPosted: Thu Nov 29, 2012 6:33 pm
by steinef
Because in that case I can only VIEW the Dataset.

Since it is still open and I can't perform a proper "ISREDIT END" or "ISREDIT CANCEL" I can't do another EDIT on that Dataset/Member.

I would have to open that Dataset in VIEW mode with the new panel, perform my changes, cut the content of the Dataset/Member, close the VIEW Session, and paste it in the beneath lying EDIT Session. I guess that would work, but it is not a solution I would prefer.

To be honest, I like to test the idea of prino: Creating a pop-up panel which receives the long command and passes it to the edit session. I picture this a bit like the panel of option 6 in the Primary Option Menu. But I am not sure whether I can combine commands writen in an extra pop-up panel with line commands in the edit session.

The proof of the pudding is in the eating. - I'll keep you guys posted. Thanks again for your ideas. I honestly appreciate it

Re: EditMacro "ISREDIT END" does not close Member/PS-Dataset

PostPosted: Thu Nov 29, 2012 7:31 pm
by Pedro
Because in that case I can only VIEW the Dataset.


I was not questioning the use of VIEW... I questioned why you rename from &ZPANELID to CLINE and back. You can use CLINE without renaming it by specifying the panel name on the VIEW service call.

Re: EditMacro "ISREDIT END" does not close Member/PS-Dataset

PostPosted: Thu Nov 29, 2012 7:50 pm
by steinef
To make it permanent in the editor.

The panels are usally named ISREDDEx but I don't know the exact name beforehand (ISREDDE4, ISREDDE3) . So I get the name by reading ZPANELID and change the name of my SCLINE panel to that value, so the new panel should be activated permanently.