Joined: 07 Feb 2009 Posts: 1306 Location: Vilnius, Lithuania
The following exec (I've called it EDITCLIP) can be used as both a TSO command and as an edit macro to edit any of the available ISPF clipboards completely under program control.
Code:
/* REXX exec to programatically edit any ISPF clipboard */
/*** trace ?r ***************************************************** \! *
* (C) Copyright Robert AH Prins, 2009-2009 *
************************************************************************
* ------------------------------------------------------------------ *
* ! Date ! By ! Remarks ! *
* !------------+------+----------------------------------------------! *
* ! ! ! ! *
* !------------+------+----------------------------------------------! *
* ! 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. *
************************************************************************
* 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 clipmac '/' board
"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
/*******************************************************************
* Clean up *
*******************************************************************/
"ispexec qlibdef ispplib id(id)"
"ispexec libdef ispplib"
"free f("id")"
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"
"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!
Invocation is either "TSO EDITCLIP {macro}{/clipboard}" or, if in Edit or View, just "EDITCLIP {macro}{/clipboard}"
The invocation parameters are
macro: the edit macro to process the contents of the selected clipboard
clipboard: the clipboard to process. If the specified clipboard does not exist, EDITCLIP will process the always present DEFAULT clipboard.
To just view a clipboard, "macro" can be omitted, but the slash must be included. Omitting both "macro" and "/clipboard" will display the ISPF Default clipboard.
Be careful with PC-MF transfers, the '\!' on the second line of the source indicate the NOT(\) and OR(!) characaters.
Joined: 07 Feb 2009 Posts: 1306 Location: Vilnius, Lithuania
This is an updated version of the above, most important change, if you are using it, is the reversal of macro and clipboard upon invocation.
For what it's worth, is anyone, other than yours truly, ever using this macro?
If yes, please add a reply (or PM/email me) telling us what you are using it for?
Code:
/* 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
"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 edit 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))
/***************************************************************
* 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"
"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|