ISPF Clipboard Utility and ISPF ZSTART

Time Sharing Option, Interactive System Productivity Facility and REstructured eXtended eXecutor

Moderator: mickeydusaor

Post Reply
Lbdyck
Registered Member
Posts: 12
Joined: Wed Feb 10, 2016 8:42 pm

ISPF Clipboard Utility and ISPF ZSTART

Post by Lbdyck »

Several of my in-house users were asking a few weeks ago how to use the ISPF Cut and Paste. As part of that discussion I learned they didn't know about using user defined clipboards - they only used the default clipboard. To simplify the use of clipboards I developed an ISPF dialog I called SETCLIP to simplify defining up to 10 user clipboards from existing files. I'm attaching it here.

IBM provided the ability to have user commands invoked each time ISPF starts by updating the ZSTART profile variable. By added the setclip command (see the setclip doc/tutorial) to ZSTART you can have the user clipboards available everytime ISPF starts. I'm also attaching a copy of the ZSTART ISPF dialog.

I hope y'all find these helpful.
You do not have the required permissions to view the files attached to this post.
User avatar
prino
Registered Member
Posts: 68
Joined: Sun Jun 01, 2014 4:15 am
Location: Vilnius, Lithuania
Contact:

Re: ISPF Clipboard Utility and ISPF ZSTART

Post by prino »

Nice one, but why set up 10 clipboards?

Anyway...

Maybe you also want to add the below code to your system. It allows "unattended" editing of ISPF clipboards, both from within Edit (as a macro) as well as from the commandline, provided you've set up an entry in the SITECMDS (or whatever you call it) command table.

My command table entry read like:

Code: Select all

Verb  . . : ECLIP
Trunc . . : 0
Action  . : SELECT CMD(%EDITCLIP &ZPARM) NEWAPPL(ISR) SCRNAME(EDITCLIP)
Description Edit any clipboard
And here is the code:

Code: Select all

/* REXX exec to programatically edit any ISPF clipboard               */
/*** trace ?r ***************************************************** \| *
*               (C) Copyright Robert AH Prins, 2009-2012               *
************************************************************************
*  ------------------------------------------------------------------  *
* | Date       | By   | Remarks                                      | *
* |------------+------+----------------------------------------------| *
* |            |      |                                              | *
* |------------+------+----------------------------------------------| *
* | 2012-07-09 | RAHP | LMINIT cannot handle concatenation with more | *
* |            |      | than 16 data sets                            | *
* |------------+------+----------------------------------------------| *
* | 2010-01-13 | RAHP | *ENDREXX must be uppercase on old versions   | *
* |            |      | of z/OS                                      | *
* |------------+------+----------------------------------------------| *
* | 2009-07-02 | RAHP | Allow selection of Clipboard                 | *
* |------------+------+----------------------------------------------| *
* | 2009-06-15 | RAHP | Initial version                              | *
* |------------+------+----------------------------------------------| *
************************************************************************
* EDITCLIP is a REXX exec/edit macro to edit any ISPF clipboard        *
* without manual intervention with a user-specified macro, or manually *
* if no macro is specified.                                            *
*                                                                      *
* The method of automagically processing the ISPF default clipboard    *
* by replacing the ISRECUTL panel was inspired by Doug Nadel's macro   *
* (See <http://sillysot.com/ftp/sdsf_highlighting.txt) to create a     *
* customised ISFPCU41 panel that adds smart highlighting to SDSF.      *
************************************************************************
* Send questions, suggestions and/or bug reports to:                   *
*                                                                      *
* robert@prino.org / robert.ah.prins@gmail.com                         *
*                                                                      *
* Robert AH Prins                                                      *
* Taboralaan 46                                                        *
* 8400 Oostende                                                        *
* Belgium                                                              *
************************************************************************
* This program is free software: you can redistribute it and/or        *
* modify it under the terms of the GNU General Public License as       *
* published by the Free Software Foundation, either version 3 of       *
* the License, or (at your option) any later version.                  *
*                                                                      *
* This program is distributed in the hope that it will be useful,      *
* but WITHOUT ANY WARRANTY; without even the implied warranty of       *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the         *
* GNU General Public License for more details.                         *
*                                                                      *
* You should have received a copy of the GNU General Public License    *
* along with this program. If not, see <http://www.gnu.org/licenses/>  *
***********************************************************************/
parse source source
parse value source with . . moi .

"ispexec control errors return"

arg parm
"isredit macro (parm)"

parse value translate(space(parm, 0)) with board '/' clipmac

"ispexec vget (editclip)"
if rc = 0 then
  do
    "ispexec verase (editclip)"

    select
      when left(editclip, 1) = x2c(00) then
        do
          editclip = substr(editclip, 2)

          select
            when editclip = 'BUILD_ISRECUTL' then
              call build_isrecutl

            otherwise
          end
        end

      otherwise
    end
  end
else
  do
    /*******************************************************************
    * Build a copy of 'ISRECUTL' with a bit of extra code that allows  *
    * unattended processing of the selected clipboard                  *
    *******************************************************************/
    drop plib

    editclip = x2c(0)'BUILD_ISRECUTL'
    "ispexec vput (editclip)"

    "ispexec lminit dataid(plib) ddname(ispplib) enq(shr)"
    if rc = 0 then
      do
        "ispexec view dataid("plib") member(isrecutl) macro("moi")"
        "ispexec lmfree dataid("plib")"

        ok = 1
      end
    else
      do
        "ispexec qbaselib ispplib id(ispplib)"
        ispplib = space(translate(ispplib, '  ', "',"))

        ok = 0
        do until ok | ispplib = ''
          parse value ispplib with dsn ispplib

          ok = sysdsn("'"dsn"(isrecutl)'") = 'OK'

          if ok then
            "ispexec view dataset('"dsn"(isrecutl)') macro("moi")"
        end
      end

    if ok then
      do
        /***************************************************************
        * Set up the initial macro                                     *
        ***************************************************************/
        "ispexec vget (zusermac) profile"
        savemac  = zusermac
        zusermac = strip(left(clipmac, 8))

        "ispexec vput (board)"
        "ispexec vput (zusermac) profile"
        "ispexec select pgm(isrclipb)"

        zusermac = savemac
        "ispexec vput (zusermac) profile"

        /***************************************************************
        * Clean up                                                     *
        ***************************************************************/
        "ispexec qlibdef ispplib id(id)"
        "ispexec libdef ispplib"
        "free f("id")"
      end
    else
      do
        zedsmsg = ''
        zedlmsg = 'A severe error has occurred,' moi ' processing has',
                  'terminated. The developer may be able to provide a',
                  'solution to the problem.'

        "ispexec setmsg msg(ISRZ001)"
      end
  end
exit

/***********************************************************************
* BUILD_ISRECUTL:                                                      *
*                                                                      *
* This procedure retrieves the original ISRECUTL panel, provided it is *
* in a dataset allocated to ISPPLIB. It adds some code to the panel to *
* enable editing the clipboard without user intervention. The modified *
* panel is saved into a temporary dataset that is subsequently used in *
* a LIBDEF of ISPPLIB.                                                 *
***********************************************************************/
build_isrecutl:
  "isredit macro"

  dynlib = 'pan'random(99999)
  alloc  = "alloc fi("dynlib") rtdsn(sysdsname) "   ||,
                     "lrecl(80) blksize(0) dir(5) " ||,
                     "new delete reuse "            ||,
                     "space(1,1)"
  rc = bpxwdyn(alloc)

  if rc = 0 then
    ispdyn = sysdsname
  else
    ispdyn = 'NOT FOUND'

  "newstack"

  "isredit (ZL) = linenum .zl"

  do i = 1 to zl
    "isredit (L) = line" i

    if left(l, 5) = ')PROC' then
      do
        /***************************************************************
        * Insert additional code into the 'INIT' section               *
        ***************************************************************/
        queue '/* Additional INIT code */'
        queue 'vget (board)'
        queue ' '
        queue '*REXX(zcutlist,board,autoclip)'
        queue '  ok = 0'
        queue ' '
        queue '  if autoclip \= ''OK'' then'
        queue '    do cb = 5 by 63 to length(zcutlist) until ok'
        queue '      ok = strip(substr(zcutlist, cb, 8)) = board'
        queue '    end'
        queue ' '
        queue '  if \ok then'
        queue '    zcutlist = overlay(''E'', zcutlist, 3)'
        queue '  else'
        queue '    zcutlist = overlay(''E'', zcutlist, cb - 2)'
        queue '*ENDREXX'
        queue ' '
        queue 'if (&autoclip = &z)'
        queue '  .resp=enter'
        queue 'else'
        queue '  .resp=end'

        queue l

        /***************************************************************
        * Insert additional code into the 'PROC' section               *
        ***************************************************************/
        queue '/* Additional PROC code */'
        queue '&autoclip = OK'
      end
    else
      queue l
  end

  tfil = 'tfil'random(9999)

  "alloc f("tfil") da('"ispdyn"(isrecutl)') shr reu"
  "execio" queued() "diskw "tfil" (finis"
  "free f("tfil")"

  "delstack"

  "isredit can"

  "ispexec libdef ispplib library id("dynlib") stack"
return
/***********************************************************************
Structure of zcutlist, for clarity the actual attribute characters 01,
02, 03 and 04 have been replaced by {, }, ¢ and !. The three rows below
are all concatenated|

{ 01 TYPE(DATAOUT)
} 02 TYPE(DATAOUT) INTENS(LOW)
¢ 03 TYPE(DATAIN)  JUST(LEFT) HILITE(USCORE)
! 04 TYPE(DATAIN)  CAPS(ON)   HILITE(USCORE)
....v....1....v....2....v....3....v....4....v....5....v....6...
 ! {DEFAULT }      21¢ISPF Default Clipboard                  {
 ! {WHATEVER}      20¢A user defined clipboard                {
 ! {ANOTHER }      20¢Another user defined clipboard          {
***********************************************************************/
Usage in the editor:

editclip - will edit 'CLIPBOARD:DEFAULT'
editclip qq - will edit 'CLIPBOARD:QQ'
editclip /mymac - will edit 'CLIPBOARD:DEFAULT', running mymac as a macro
editclip qq/mymac - will edit 'CLIPBOARD:QQ', running mymac as a macro

and of course it you invoke editclip in another macro, and "mymac" contains an "isredit end" statement, you can edit any clipboard completely unattended. ;)

Using the ECLIP command is similar:

eclip - will edit 'CLIPBOARD:DEFAULT'
eclip qq - will edit 'CLIPBOARD:QQ'
eclip /mymac - will edit 'CLIPBOARD:DEFAULT', running mymac as a macro
eclip qq/mymac - will edit 'CLIPBOARD:QQ', running mymac as a macro

And no, ECLIP cannot create a new clipboard on-the-fly, trying to edit a non-existing one will result in editing 'CLIPBOARD:DEFAULT'.
Robert
Robert AH Prins
robertahprins @ the.17+Gb.Google thingy
Some z/OS code here
Lbdyck
Registered Member
Posts: 12
Joined: Wed Feb 10, 2016 8:42 pm

Re: ISPF Clipboard Utility and ISPF ZSTART

Post by Lbdyck »

eclip looks interesting.

why 10 you asked - because that is the limit that IBM allows using their native clipboard facility (actually 11 but clipboard 1 is the Default).

With eclip how do you access the invidiual clipboards or are you using a custom, non-ibm, cut/paste that stores clipboards externally in a file?
User avatar
prino
Registered Member
Posts: 68
Joined: Sun Jun 01, 2014 4:15 am
Location: Vilnius, Lithuania
Contact:

Re: ISPF Clipboard Utility and ISPF ZSTART

Post by prino »

I access the clipboards using their name, by selecting them with an on-the-fly customized panel that sets the response (.resp) to END.

Install the exec, go into edit, CUT anything, give the command "EDITCLIP". This should bring up the CLIPBOARD:DEFAULT. Now enter ISRDDN (or TSO DDLIST) and look for a DDNAME 'PANxxxxx". It will contain the on-the-fly modified 'ISRECUTL' panel that you would normally find in 'ISP.SISPPENU' (or whatever your organisation renamed that to) - when in the ISRDDN screen you can give the command "M ISRECUTL" to find out where the original resides.

As I wrote before, "ECLIP whatever" will access "CLIPBOARD:whatever" provided it exists. If it does not, it will access CLIPBOARD:DEFAULT.
Robert AH Prins
robertahprins @ the.17+Gb.Google thingy
Some z/OS code here
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “TSO, ISPF & REXX (Do you still do CLIST?!).”