since I am at it
here is an ISPF Dialog to "
mass change" strings in a PDS
it has member name filtering facilities
and process members using a string found/not found logic
( process a member if it contains/does-not-contain string )
note note note
the FROM and TO strings can be any valid FROM/TO string accepted by ISPF
done some elementary checking for bad tokens,
a symptom of a missing check is a return code of 20 fro edit
note note note
REXX scripts
MASSCHG
MASSCHG2
panel(s)
MASSCHG
skels
MASSCHG1
MASSCHG2
MASSCHG3
support elements
panel(s)
XNOHELP
messages
XMSG00
the scripts
Code: Select all
/* REXX */
Trace "O"
Parse Source _sys _how _cmd .
chgcmd = _cmd
If Sysvar(SYSISPF) \= "ACTIVE" Then Do
Say left(_cmd,8)"- Ispf is not active. Command not executed"
Exit 4
End
/*
call $ispex "CONTROL ERRORS RETURN"
*/
xRC = $ispex("FTOPEN TEMP")
If xRC \= 0 Then Do
xmsgsm = left(_cmd,8)"- RC("xRC")"
xmsglm = left(_cmd,8)"- RC("xRC") FTOPEN "
call $ispex "SETMSG MSG(XMSG001) "
exit
End
disp = 0
do while ( $ispex("DISPLAY PANEL(MASSCHG) ") = 0 )
cmax = strip(cmax)
filt = strip(filt)
opts = space(opts)
if opts = "" then ,
opts = "ALL"
exclSTR = strip(exclSTR)
inclSTR = strip(inclSTR)
call $ispex "VPUT (CMAX, OPTS, exclSTR, inclSTR ) SHARED "
do i = 1 to cmax
if symbol("fromSTR"i) \= "VAR" then
z = value("fromSTR"i,"")
if symbol("toSTR"i) \= "VAR" then
z = value("toSTR"i,"")
call $ispex "VPUT (fromSTR"i" toSTR"i") SHARED "
end
call $ispex "FTINCL MASSCHG1 "
disp = 1
/* LMINIT */
xRC = $ispex("LMINIT DATAID(ID) DATASET("dsnm") ENQ(SHR) ")
If xRC \= 0 Then Do
xmsgsm = left(_cmd,8)"- RC("xRC")"
xmsglm = left(_cmd,8)"- "zerrlm
call $ispex "SETMSG MSG(XMSG001) "
iterate
End
/* LMOPEN */
xRC = $ispex("LMOPEN DATAID("ID") OPTION(INPUT) ")
If xRC \= 0 Then Do
xmsgsm = left(_cmd,8)"- RC("xRC")"
xmsglm = left(_cmd,8)"- "zerrlm
call $ispex "SETMSG MSG(XMSG001) "
call $ispex "LMFREE DATAID("ID") "
iterate
End
memb = ""
coun = 0
lmmlist = "LMMLIST DATAID("ID") OPTION (LIST) " || ,
"MEMBER(MEMB) PATTERN("filt") "
do while ($ispex(lmmlist) = 0 )
edit = "EDIT DATAID("id") MEMBER("memb") MACRO(MASSCHG2) "
xEDRC = $ispex(edit)
if xEDRC = 0 then ,
done = "SAVED"
else ,
done = "NOT CHANGED"
coun = coun + 1
call $ispex "VGET (CHGS,ERRS) SHARED "
call $ispex "FTINCL MASSCHG2 "
end
/* LMMLIST FREE */
xRC = $ispex("LMMLIST DATAID("ID") OPTION (FREE) ")
/* LMCLOSE */
xRC = $ispex("LMCLOSE DATAID("ID") ")
If xRC \= 0 Then Do
xmsgsm = left(_cmd,8)"- RC("xRC")"
xmsglm = left(_cmd,8)"- "zerrlm
call $ispex "SETMSG MSG(XMSG001) "
End
/* LMFREE */
xRC = $ispex("LMFREE DATAID("ID") ")
If xRC \= 0 Then Do
xmsgsm = left(_cmd,8)"- RC("xRC")"
xmsglm = left(_cmd,8)"- "zerrlm
call $ispex "SETMSG MSG(XMSG001) "
End
call $ispex "FTINCL MASSCHG3 "
xmsgsm = left(_cmd,8)"- done"
xmsglm = left(_cmd,8)"- done"
call $ispex "SETMSG MSG(XMSG001) "
End
call $ispex "FTCLOSE"
if disp = 1 then do
call $ispex "VGET ZTEMPF"
call $ispex "VIEW DATASET('"ZTEMPF"') "
end
xmsgsm = left(_cmd,8)"- done"
xmsglm = left(_cmd,8)"- done"
call $ispex "SETMSG MSG(XMSG001) "
Exit
/* */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
$ispex:
isp_0tr = trace("O")
Address ISPEXEC arg(1)
isp_0rc = rc
trace value(isp_0tr)
return isp_0rc
/* */
$isred:
isr_0tr = trace("O")
Address ISREDIT arg(1)
isr_0rc = rc
trace value(isr_0tr)
return isr_0rc
/* */
$tsoex:
tso_0tr = trace("O")
Address TSO arg(1)
tso_0rc = rc
trace value(tso_0tr)
return tso_0rc
Code: Select all
/* REXX */
Trace "O"
Parse Source _sys _how _cmd .
If Sysvar(SYSISPF) \= "ACTIVE" Then Do
Say left(_cmd,8)"- Ispf is not active. Command not executed"
Exit 4
End
/*
call $ispex "CONTROL ERRORS RETURN"
*/
chgs = 0; errs = 0
call $ispex "VPUT (CHGS,ERRS) SHARED"
if $isred("MACRO (ZPARMS) NOPROCESS ") \= 0 then
exit 8
if $ispex("VGET (cmax,opts,exclSTR,inclSTR) SHARED" ) = 0 then do
do i = 1 to cmax
call $ispex "VGET (fromSTR"i" toSTR"i") SHARED"
end
if strip(inclSTR) = "" then ,
inclRC = 0
else ,
inclRC = $isred("FIND &&inclSTR. FIRST")
if strip(exclSTR) = "" then ,
exclRC = 4
else ,
exclRC = $isred("FIND &&exclSTR. FIRST")
if inclRC = 0 & exclRC = 4 then do
chgs = 0; errs = 0
do i = 1 to cmax
fromSTR = VALUE("fromSTR"i)
if strip(fromSTR) = "" then ,
iterate
toSTR = VALUE("toSTR"i)
xRC = $isred("CHANGE &&fromSTR. &&toSTR. ALL")
call $isred "(C,E) = CHANGE_COUNTS"
chgs = chgs + c
errs = errs + e
end
call $ispex "VPUT (CHGS,ERRS) SHARED"
if errs = 0 then do
call $isred "END"
exit 0
end
end
end
call $isred "CANCEL"
exit 1
/* */
$tsoex:
tso_0tr = trace("O")
Address TSO arg(1)
tso_0rc = rc
trace value(tso_0tr)
return tso_0rc
/* */
$ispex:
isp_0tr = trace("O")
Address ISPEXEC arg(1)
isp_0rc = rc
trace value(isp_0tr)
return isp_0rc
/* */
$isred:
isr_0tr = trace("O")
Address ISREDIT arg(1)
isr_0rc = rc
trace value(isr_0tr)
return isr_0rc
the panel
Code: Select all
)ATTR DEFAULT(%+_)
$ TYPE(INPUT) INTENS(LOW) PAD(' ')
! TYPE(INPUT) INTENS(LOW) CAPS(OFF) JUST(ASIS)
)BODY EXPAND(\\)
%-\-\- Mass Change -\-\-
%COMMAND ===>_ZCMD
+
+Dataset ==>$dsnm +
+: From +: To
+:!fromSTR1 +:!toSTR1
+:!fromSTR2 +:!toSTR2
+:!fromSTR3 +:!toSTR3
+:!fromSTR4 +:!toSTR4
+:!fromSTR5 +:!toSTR5
+:!fromSTR6 +:!toSTR6
+-\-\-
+:From/To
+-\-\-
+:!fromSTR7
+:!toSTR7
+-\-\-
+:!fromSTR8
+:!toSTR8
+-\-\-
+ Options ==>$opts +
+ Mbr Filter ==>$filt +
+ Excl Trigger ==>$exclSTR +
+ Incl Trigger ==>$inclSTR +
)INIT
)REINIT
)PROC
&cmax = 8
ver(&dsnm,nb,dsname)
ver(&fromSTR1,nb)
ver(&toSTR1,nb)
IF (&fromSTR2 ^= ' ')
VER(&toSTR2,NB)
IF (&fromSTR3 ^= ' ')
VER(&toSTR3,NB)
IF (&fromSTR4 ^= ' ')
VER(&toSTR4,NB)
IF (&fromSTR5 ^= ' ')
VER(&toSTR5,NB)
IF (&fromSTR6 ^= ' ')
VER(&toSTR6,NB)
IF (&fromSTR7 ^= ' ')
VER(&toSTR7,NB)
IF (&fromSTR8 ^= ' ')
VER(&toSTR8,NB)
*REXX(*,CMAX,XMSGSM,XMSGLM)
do i = 1 to cmax
wstr = translate(strip(VALUE("fromSTR"i)))
if wordpos(wstr,"NEXT PREV FIRST LAST ALL") > 0 then ,
signal strerr
if wordpos(wstr,"CHARS PREFIX SUFFIX WORD") > 0 then ,
signal strerr
if wordpos(wstr,"X NX") > 0 then ,
signal strerr
wstr = translate(strip(VALUE("toSTR"i)))
if wordpos(wstr,"NEXT PREV FIRST LAST ALL") > 0 then ,
signal strerr
if wordpos(wstr,"CHARS PREFIX SUFFIX WORD") > 0 then ,
signal strerr
if wordpos(wstr,"X NX") > 0 then ,
signal strerr
end
zrxrc = 0
return
strerr:
xmsgsm = "ERROR"
xmsglm = "From/To invalid string"
zrxmsg = "XMSG001"
zrxrc = 8
return
*ENDREXX
)END
the skels
Code: Select all
)DEFAULT )&?!<|>
)CM
)SETF XC = &LEFT(&CHGCMD,8)
Dataset : &dsnm
)BLANK
)IF &FILT ^= &Z THEN
Filter : &filt
)IF &OPTS ^= &Z THEN
Options : &opts
)IF &exclSTR ^= &Z THEN
Exclude : &exclSTR
)IF &inclSTR ^= &Z THEN
Include : &inclSTR
)BLANK
)IF &fromSTR1 ^= &Z THEN )DO
From/To : &fromSTR1
: &toSTR1
)ENDDO
)IF &fromSTR2 ^= &Z THEN )DO
From/To : &fromSTR2
: &toSTR2
)ENDDO
)IF &fromSTR3 ^= &Z THEN )DO
From/To : &fromSTR3
: &toSTR3
)ENDDO
)IF &fromSTR4 ^= &Z THEN )DO
From/To : &fromSTR4
: &toSTR4
)ENDDO
)IF &fromSTR5 ^= &Z THEN )DO
From/To : &fromSTR5
: &toSTR5
)ENDDO
)IF &fromSTR6 ^= &Z THEN )DO
From/To : &fromSTR6
: &toSTR6
)ENDDO
)IF &fromSTR7 ^= &Z THEN )DO
From/To : &fromSTR7
: &toSTR7
)ENDDO
)IF &fromSTR8 ^= &Z THEN )DO
From/To : &fromSTR8
: &toSTR8
)ENDDO
)BLANK
Code: Select all
)DEFAULT )&?!<|>
)CM
)SETF MB = &LEFT(&MEMB,8)
)SETF CC = &STRIP(&CHGS,L,0)
)SETF EC = &STRIP(&ERRS,L,0)
)IF &XEDRC = 0 THEN
Member : &MB Chgs(&CC) Errs(&EC)
)ELSE
Member : &MB NOT CHANGED
Code: Select all
)DEFAULT )&?!<|>
)CM
)BLANK
Process : &coun
)BLANK 2
the support panel
Code: Select all
)ATTR
@ AREA(SCRL) EXTEND(ON)
% TYPE(ET)
_ TYPE(NEF) PAD(USER) CAPS(ON)
+ TYPE(NT)
)BODY EXPAND(\\)
%-\-\- T U T O R I A L -\-\-
%OPTION ===>_ZCMD +
@SAREA1 @
)AREA SAREA1
%
%
% ******************************************************************
% * *
% * *
% * SORRY *
% * *
% * *
% * There is no tutorial to be viewed. *
% * *
% * *
% * +Enter%END+to return. *
% * *
% * *
% ******************************************************************
)PROC
)END
the support messages
Code: Select all
XMSG000 '&XMSGSM' .ALARM = &XALARM .HELP = &XHELP NOKANA
'&XMSGLM'
XMSG001 '&XMSGSM' .ALARM = NO .HELP = XNOHELP NOKANA
'&XMSGLM'
XMSG002 '&XMSGSM' .ALARM = NO .HELP = XNOHELP NOKANA
'&XMSGLM'
there are still a couple of glitches,
but nothing so serious to make the thing unusable
enjoy
--)