Here's the free-of-any errorchecking, I've only ever used it myself, small
exec to update command tables using the standard ISPF dialog. Obviously,
you still need to restart ISPF to enable the new commands. And of course
saving them, like I do, in my private EXEC library could be omitted.

Enjoy

/* REXX exec to update my command tables                              */
/*** trace ?r ***************************************************** \| *
*               (C) Copyright Robert AH Prins, 2009-2010               *
************************************************************************
*  ------------------------------------------------------------------  *
* | Date       | By   | Remarks                                      | *
* |------------+------+----------------------------------------------| *
* |            |      |                                              | *
* |------------+------+----------------------------------------------| *
* | 2010-05-13 | RAHP | Use ISPTABL, not ISPPROF                     | *
* |------------+------+----------------------------------------------| *
* | 2009-04-16 | RAHP | Now RAHP- and HERECMDS                       | *
* |------------+------+----------------------------------------------| *
* | 2009-04-08 | RAHP | Initial version                              | *
* |------------+------+----------------------------------------------| *
************************************************************************
* UCMDS is a REXX exec to update my site-independent (RAHPCMDS) and    *
* site-specific (HERECMDS) tables. Because it is not possible to       *
* update an open ISPF command table, this exec copies it to $$$$CMDS,  *
* invokes ISPUCM (the command table update program) with a parameter   *
* of $$$$ and then copies the updated table back to USERCMDS. Note     *
* that is necessary to restart ISPF to enable any new commands.        *
*                                                                      *
* Copies of the new command tables are saved to my exec library.       *
*                                                                      *
* Note:                                                                *
*                                                                      *
* *"GETVAR" is my routine that retrieves site-dependent information,*    *
* *such as the names of my datasets allocated to ISPF etc.*              *
************************************************************************
* Send questions, suggestions and/or bug reports to:                   *
*                                                                      *
* rob...@prino.org / robert.ah.pr...@gmail.com                         *
*                                                                      *
* Robert AH Prins                                                      *
* Ozkiniu gatve 48                                                     *
* Vilnius 08405                                                        *
* Lithuania                                                            *
************************************************************************
* 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 .

user.  = -1
user.1 = 'RAHP'
user.2 = 'HERE'

"ispexec vget (ucmds) shared"

if rc = 0 then
  do
    "ispexec verase (ucmds) shared"

    temp = copies('$', length(ucmds))

    "isredit macro"
    "isredit (MEM) = member"

    select
      when mem = temp'CMDS' then
        "isredit c '"temp"CMDS' '"ucmds"CMDS' first"

      /* irrelevant code removed */

      otherwise
    end

    "isredit end"

    exit
  end

!tabl = getvar('ispTABL')

drop isptabl
drop exec

"ispexec lminit dataid("isptabl") ddname(isptabl) enq(shrw)"
"ispexec lminit dataid("exec")",
               "dataset('"getvar('execRAHP')"') enq(shrw)"

do u = 1 by 1 while user.u \= -1
  temp  = copies('$', length(user.u))
  ucmds = user.u

  "alloc f(i) da('"!tabl"("user.u"cmds)') shr reu"
  "alloc f(o) da('"!tabl"("temp"cmds)') shr reu"

  "execio * diskr i (finis"
  "execio" queued() "diskw o (finis"

  "ispexec select pgm(ispucm) parm("temp")"

  "ispexec vput (ucmds) shared"
  "ispexec edit dataid("isptabl") member("temp"cmds) macro("moi")"

  "execio * diskr o (finis"
  "execio" queued() "diskw i (finis"

  "free f(i)"
  "free f(o)"

  "ispexec lmcopy fromid("isptabl")   todataid("exec")",
                 "frommem("temp"cmds) tomem("user.u"cmds) replace"
end

"ispexec lmfree dataid("exec")"
"ispexec lmfree dataid("isptabl")"
exit

Robert
-- 
Robert AH Prins
robert(a)prino(d)org
The hitchhiking grandfather <https://prino.neocities.org/index.html>
Some REXX code for use on z/OS
<https://prino.neocities.org/zOS/zOS-Tools.html>

On Tue, 23 Jan 2024 at 07:43, Jon Perryman <jperr...@pacbell.net> wrote:

> >Create a site ISPF command table and add your commands to that.
>
> An alternative to creating a site ISPF command table is to dynamically add
> ISPF commands. Command tables are ISPF tables that can be updated using
> TBADD, TBDEL and TBUPD. ISPCMDS is always open (probably ISRCMDS too). When
> you start ISPF, you can specify a REXX to be run that TBADD's your commands
> and they will remain in effect while ISPF is running. I never experimented
> with NEWAPPL commands so I can't tell you if that command table is
> automatically closed or remains open until ISPF is terminated.
>
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to