|
View previous topic :: View next topic
|
| Author |
Message |
rajatbagga
Active User

Joined: 11 Mar 2007 Posts: 199 Location: india
|
|
|
|
Hello People,
I wanted to know if there is any way in CLIST to identify symbol '&' in a string. I want to handle a situation in my CLIST where if the input string passed to CLIST contains '&' then do XYZ (for say)
At the moment its not accepting any CLIST inbuilt functions which i can use to check if '&' is present anywhere in the string.
I always receive an error with function used saying :-
IKJ56545I THIS STATEMENT HAS AN INVALID SYMBOLIC VARIABLE
Thank You,
Rajat |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Have you tried "doubling it up"?
I don't suppose so many people actually write CLISTs today. So much easier to code, maintain, understand in Rexx.
And of course, don't forget to blow the dust off the manual. |
|
| Back to top |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10902 Location: italy
|
|
|
|
a yes/no question deserves a yes/no answer
YES... it is possible (there are gazillions of legacy clists doing it)
we are in the 21st century, not in the stone age
why keep writing things using an obsolete <language>
use REXX
worth spending a bit of time learning it,
You and Your organization will enjoy a much faster delivery time
and finally why not do a bit of research Yoursef
reading the manuals or lazily googling for clist ampersand processing
landing here
publib.boulder.ibm.com/infocenter/zos/v1r11/index.jsp?topic=/com.ibm.zos.r11.ikjb800/ikj4b85042.htm |
|
| Back to top |
|
 |
mistah kurtz
Active User
Joined: 28 Jan 2012 Posts: 316 Location: Room: TREE(3). Hilbert's Hotel
|
|
|
|
| HI..as Bill suggested..try doubling it up..I had faced a similar problem in REXX...where I had to use '&&&&' to identify a single '&'. |
|
| Back to top |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10902 Location: italy
|
|
|
|
| Quote: |
| I had faced a similar problem in REXX...where I had to use '&&&&' to identify a single '&'. |
post evidence please
a snippet which demonstrates it! |
|
| Back to top |
|
 |
mistah kurtz
Active User
Joined: 28 Jan 2012 Posts: 316 Location: Room: TREE(3). Hilbert's Hotel
|
|
|
|
ok..its going to be a long post:
The Purpose of this REXX code was to search for the OLD string and replace it with a new string in a PDS.
Rexx Main Code:
| Code: |
/******************REXX*******************/
ISREDIT "MACRO PROCESS"
TRACE I
PROF NOPREF
PANEL="YYYYY.REXX.PANEL"
ADDRESS ISPEXEC "LIBDEF ISPPLIB DATASET ID(&PANEL) UNCOND"
DO FOREVER
INPUT1 = ' '
INPUT2 = ' '
ADDRESS ISPEXEC "DISPLAY PANEL(PNL1)"
"ISPEXEC VGET (ZPFKEY) ASIS"
"ISPEXEC VPUT (INPUT1) SHARED"
"ISPEXEC VPUT (INPUT2) SHARED"
"ISPEXEC VPUT (MDSN) SHARED"
DISRC1 = RC
IF ZPFKEY = 'PF03' THEN
LEAVE
IF INPUT1 \= ' ' THEN
DO
IF INPUT2 \= ' ' THEN
DO
IF SYSDSN(MDSN) \= "OK" THEN
"ISPEXEC VPUT (INPUT1) SHARED"
"ISPEXEC VPUT (INPUT2) SHARED"
X=OUTTRAP('N.')
SAY MDSN
"LISTDS" MDSN "MEMBER"
X=OUTTRAP('OFF')
SAY " "
SAY "TOTAL" N.0-6 "MEMBERS OF",
MDSN "TO BE PROCESSED.........."
SAY "MEMBERS STATUS "
DO I=7 TO N.0
MEM=STRIP(N.I,B)
MYFILE=MDSN || '(' || MEM || ')'
ADDRESS ISPEXEC "EDIT DATASET("MYFILE") MACRO(IM001)"
SAY MEM " PROCESSED SUCCESSFULLY"
END
DROP N.
END
END
END |
Macro IM001:
| Code: |
/*REXX*/
ISREDIT "MACRO PROCESS"
TRACE OFF
"ISREDIT (USTAT) = USER_STATE"
"ISPEXEC VGET (ENDEXEC) SHARED"
"ISPEXEC VGET (INPUT2) SHARED"
"ISPEXEC VGET (INPUT1) SHARED"
ISREDIT "C ALL " INPUT1 INPUT2
ISREDIT "RESET "
ISREDIT "END"
EXIT |
When you will execute the main REXX it will show you below Panel, which will ask you to input OLD string, New String and PDS name.
Here My Inputs are:
OLD STRING = &AB
NEW STRING = &CD
| Code: |
---------------------------------------------------------------------
| ------------------ CHANGE STRING UTILITY -------------------- |
| | | |
| | | |
| | OLD STRING NAME : &AB | |
| | NEW STRING NAME : &CD | |
| | ENTER PDS NAME : XXXXX.TEST.CNTLLIB | |
| | | |
| | | |
| ----------------------------------------------------------------- |
---------------------------------------------------------------------
COMMAND ===>
<PF1>=HELP ENTER-TO PROCESS F3- END/CANCEL |
My INPUT PDS has a member which has foloowing data:
| Code: |
000001 &AB1
000002 &AB2 |
It does not change &AB to &CD , but if my inputs are &&&&AB and &&&&CD then it does the change.
Please let me know if you need more information. |
|
| Back to top |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10902 Location: italy
|
|
|
|
unfortunately Your evidence is due to a poor understanding of
the ISPF SCAN behavior and of the proper coding technique for compliancy
this is a tested CHGALL application ( WYSIWYG )
probably a bit more sophisticated than Yours
the REXX driver
| Code: |
/*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"
*/
call $ispex "FTOPEN TEMP"
do while ($ispex("DISPLAY PANEL(CHGALL)") ) = 0
filt = strip(filt)
opts = space(opts)
if opts = "" then ,
opts = "ALL"
xtrg = strip(xtrg)
itrg = strip(itrg)
call $ispex "VPUT (FSTR, TSTR, OPTS, XTRG, ITRG ) SHARED"
call $ispex "FTINCL CHGSKL1"
/* LMINIT */
zRC = $ispex("LMINIT DATAID(ID) DATASET("dsnm") ENQ(SHR) ")
If zRC \= 0 Then Do
zedsmsg = left(_cmd,8)"- RC("zRC")"
zedlmsg = left(_cmd,8)"- "zerrlm
call $ispex "SETMSG MSG(ISRZ000) "
iterate
End
/* LMOPEN */
zRC = $ispex("LMOPEN DATAID("ID") OPTION(INPUT)" )
If zRC \= 0 Then Do
zedsmsg = left(_cmd,8)"- RC("zRC")"
zedlmsg = left(_cmd,8)"- "zerrlm
call $ispex "SETMSG MSG(ISRZ000) "
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(CHGMAC) "
edrc = $ispex(edit)
if edrc = 0 then ,
done = "SAVED"
else
done = "NOT CHANGED"
coun = coun + 1
call $ispex "VGET (chgs,errs) shared"
call $ispex "FTINCL CHGSKL2"
end
call $ispex "FTINCL CHGSKL3"
/* LMCLOSE */
ispserv = left("LMCLOSE",8)
zRC = $ispex(ispserv "DATAID("ID") ")
If zRC \= 0 Then Do
zedsmsg = left(_cmd,8)"- RC("zRC")"
zerrlm = left(_cmd,8)"- "zerrlm
call $ispex "SETMSG MSG(ISRZ000) "
End
/* LMFREE */
ispserv = left("LMFREE",8)
zRC = $ispex(ispserv "DATAID("ID") ")
If zRC \= 0 Then Do
line = left(_cmd,8)"- "left(ispserv,8)" error ==>"zerrlm
call $isred "LINE_AFTER .ZLAST = DATALINE (LINE)"
zedsmsg = left(_cmd,8)"- Error"
zedlmsg = left(_cmd,8)"- RC("zRC") from" ispserv dsnm
call $ispex "SETMSG MSG(ISRZ000) "
End
zerrsm = left(_cmd,8)"- done"
zerrlm = left(_cmd,8)"- done"
call $ispex "SETMSG MSG(ISRZ002) "
End
call $ispex "FTCLOSE"
call $ispex "VGET ZTEMPF"
call $ispex "VIEW DATASET('"ZTEMPF"') "
Exit
/*REXX - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
$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
|
The Panel
| Code: |
)ATTR DEFAULT(%+_)
/* % TYPE(TEXT) INTENS(HIGH) defaults displayed for */
/* + TYPE(TEXT) INTENS(LOW) information only */
/* _ TYPE(INPUT) INTENS(HIGH) CAPS(ON) JUST(LEFT) */
$ TYPE(INPUT) INTENS(LOW) PAD(' ')
! TYPE(INPUT) INTENS(LOW) CAPS(OFF) JUST(ASIS)
)BODY EXPAND(\\)
%-\-\-
%-\-\- Change all -\-\-
%-\-\-
%COMMAND ===>_ZCMD
%
%-\-\-
+ Dataset ==>$dsnm +
%
%-\-\-
+ From String ==>!fstr +
+ To String ==>!tstr +
%
%-\-\-
+ Options ==>$opts +
+ Mbr Filter ==>$filt +
%
%-\-\-
+ Excl Trigger ==>$xtrg +
+ Incl Trigger ==>$itrg +
+
)INIT
)REINIT
)PROC
ver(&dsnm,nb,dsname)
ver(&fstr,nb)
ver(&tstr,nb)
)END
|
the edit macro
| Code: |
/*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
zerralrm = "NO"
zerrhm = "ISR2MACR"
call $ispex "CONTROL ERRORS RETURN"
if $isred("MACRO (ZPARMS) NOPROCESS ") \= 0 then do
zerrsm = "Invocation ERROR"
zerrlm = left(_cmd,8)"- Must be invoked as an edit macro"
call $ispex "SETMSG MSG(ISRZ001) "
Exit 1
end
if $ispex("VGET (FSTR,TSTR,OPTS,XTRG,ITRG) SHARED" ) = 0 then do
if strip(itrg) = "" then ,
irc = 0
else
irc = $isred("FIND '&&itrg.' FIRST")
if strip(xtrg) = "" then ,
xrc = 4
else
xrc = $isred("FIND '&&xtrg.' FIRST")
if irc = 0 & xrc = 4 then do
call $isred "CHANGE '&&fstr.' '&&tstr.' " opts
call $isred "(CHGS,ERRS) = CHANGE_COUNTS"
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
/*REXX - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
$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 skels
| Code: |
)CM CHGSKL1
)SETF xc = &LEFT(&chgcmd,8)
&xc - Dataset : '&dsnm'
&xc - From String : '&fstr'
&xc - To String : '&tstr'
)IF &filt ^= &Z THEN
&xc - Filter : '&filt'
)IF &opts ^= &Z THEN
&xc - Options : '&opts'
)IF &xtrg ^= &Z THEN
&xc - Excl Trigger : '&xtrg'
)IF &itrg ^= &Z THEN
&xc - Incl Trigger : '&itrg'
)BLANK
)CM CHGSKL2
)SETF xc = &LEFT(&chgcmd,8)
)SETF mb = &LEFT(&memb,8)
)SETF cc = &STRIP(&chgs,L,0)
)SETF ec = &STRIP(&errs,L,0)
)IF &edrc = 0 THEN
&xc - Member : '&mb' changes(&cc) errors(&ec)
)ELSE
&xc - Member : '&mb' NOT CHANGED
)CM CHGSKL3
)SETF xc = &LEFT(&chgcmd,8)
)BLANK
&xc - Members : &coun
)BLANK 2
|
one of the members before
| Code: |
EDIT ENRICO.TEST.PDS(AMP) - 01.03 Columns 00001 00072
Command ===> Scroll ===> CSR
****** ***************************** Top of Data ******************************
000001 &A
000002 &B
000003 &C
000004 &&&&
****** **************************** Bottom of Data ****************************
|
the panel ( as displayed ) with the data entered
| Code: |
-------------------------------------------------------------------------------
---------------------------------- Change all ---------------------------------
-------------------------------------------------------------------------------
COMMAND ===>
-------------------------------------------------------------------------------
Dataset ==> enrico.test.pds
-------------------------------------------------------------------------------
From String ==> &
To String ==> zqw
-------------------------------------------------------------------------------
Options ==> ALL
Mbr Filter ==>
-------------------------------------------------------------------------------
Excl Trigger ==>
Incl Trigger ==>
|
the execution log
| Code: |
VIEW ENRICO.SPFTEMP2.CNTL Columns 00001 00072
Command ===> Scroll ===> CSR
****** ***************************** Top of Data ******************************
000001 CHGALL - Dataset : 'ENRICO.TEST.PDS'
000002 CHGALL - From String : '&'
000003 CHGALL - To String : 'zqw'
000004 CHGALL - Options : 'ALL'
000005
000006 CHGALL - Member : 'A ' NOT CHANGED
000007 CHGALL - Member : 'AMP ' changes(7) errors()
000008 CHGALL - Member : 'B ' NOT CHANGED
000009 CHGALL - Member : 'C ' NOT CHANGED
000010
000011 CHGALL - Members : 4
000012
000013
****** **************************** Bottom of Data ****************************
|
the same member after
| Code: |
EDIT ENRICO.TEST.PDS(AMP) - 01.04 Columns 00001 00072
Command ===> Scroll ===> CSR
****** ***************************** Top of Data ******************************
000001 ZQWA
000002 ZQWB
000003 ZQWC
000004 ZQWZQWZQWZQW
****** **************************** Bottom of Data ****************************
|
an this time the & is in the to string
the panel
| Code: |
-------------------------------------------------------------------------------
---------------------------------- Change all ---------------------------------
-------------------------------------------------------------------------------
COMMAND ===>
-------------------------------------------------------------------------------
Dataset ==> enrico.test.pds
-------------------------------------------------------------------------------
From String ==> zqw
To String ==> &&&
-------------------------------------------------------------------------------
Options ==> ALL
Mbr Filter ==>
-------------------------------------------------------------------------------
Excl Trigger ==>
Incl Trigger ==>
|
the log
| Code: |
VIEW ENRICO.SPFTEMP2.CNTL Columns 00001 00072
Command ===> Scroll ===> CSR
****** ***************************** Top of Data ******************************
000001 CHGALL - Dataset : 'ENRICO.TEST.PDS'
000002 CHGALL - From String : 'zqw'
000003 CHGALL - To String : '&&&'
000004 CHGALL - Options : 'ALL'
000005
000006 CHGALL - Member : 'A ' NOT CHANGED
000007 CHGALL - Member : 'AMP ' changes(7) errors()
000008 CHGALL - Member : 'B ' NOT CHANGED
000009 CHGALL - Member : 'C ' NOT CHANGED
000010
000011 CHGALL - Members : 4
000012
000013
****** **************************** Bottom of Data ****************************
|
the same member
| Code: |
EDIT ENRICO.TEST.PDS(AMP) - 01.05 Columns 00001 00072
Command ===> Scroll ===> CSR
****** ***************************** Top of Data ******************************
000001 &&&A
000002 &&&B
000003 &&&C
000004 &&&&&&&&&&&&
****** **************************** Bottom of Data ****************************
|
another example with arbitrary strings with spaces
the member before
| Code: |
EDIT ENRICO.TEST.PDS(ARB) - 01.00 Columns 00001 00072
Command ===> Scroll ===> CSR
****** ***************************** Top of Data ******************************
000001 SOME STRING WITH BLANKS
****** **************************** Bottom of Data ****************************
|
the panel
| Code: |
-------------------------------------------------------------------------------
---------------------------------- Change all ---------------------------------
-------------------------------------------------------------------------------
COMMAND ===>
-------------------------------------------------------------------------------
Dataset ==> enrico.test.pds
-------------------------------------------------------------------------------
From String ==> SOME STRING WITH BLANKS
To String ==> the changed string
-------------------------------------------------------------------------------
Options ==> ALL
Mbr Filter ==>
-------------------------------------------------------------------------------
Excl Trigger ==>
Incl Trigger ==>
|
the log
| Code: |
VIEW ENRICO.SPFTEMP2.CNTL Columns 00001 00072
Command ===> Scroll ===> CSR
****** ***************************** Top of Data ******************************
000001 CHGALL - Dataset : 'ENRICO.TEST.PDS'
000002 CHGALL - From String : 'SOME STRING WITH BLANKS'
000003 CHGALL - To String : 'the changed string'
000004 CHGALL - Options : 'ALL'
000005
000006 CHGALL - Member : 'A ' NOT CHANGED
000007 CHGALL - Member : 'AMP ' NOT CHANGED
000008 CHGALL - Member : 'ARB ' changes(1) errors()
000009 CHGALL - Member : 'B ' NOT CHANGED
000010 CHGALL - Member : 'C ' NOT CHANGED
000011
000012 CHGALL - Members : 5
000013
000014
****** **************************** Bottom of Data ****************************
|
the member after
| Code: |
EDIT ENRICO.TEST.PDS(ARB) - 01.01 Columns 00001 00072
Command ===> Scroll ===> CSR
****** ***************************** Top of Data ******************************
000001 THE CHANGED STRING
****** **************************** Bottom of Data ****************************
|
there is still the glitch of the CAPS for the changed strings
but that' s something easy to take care of |
|
| Back to top |
|
 |
mistah kurtz
Active User
Joined: 28 Jan 2012 Posts: 316 Location: Room: TREE(3). Hilbert's Hotel
|
|
|
|
Hi Enrico.
Thanks for your code..I will try and run your code tomorrow..I'm not working today.
But I was just wondering how it would handle the scenario that I mentioned..like say, if I want to change DSN=&&ABCD to DSN=&&TEMP |
|
| Back to top |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10902 Location: italy
|
|
|
|
| Quote: |
| how it would handle the scenario |
Properly... what else
| Code: |
-------------------------------------------------------------------------------
---------------------------------- Change all ---------------------------------
-------------------------------------------------------------------------------
COMMAND ===>
-------------------------------------------------------------------------------
Dataset ==> enrico.test.pds
-------------------------------------------------------------------------------
From String ==> &&prev
To String ==> c'&&TEMP'
-------------------------------------------------------------------------------
Options ==> ALL
Mbr Filter ==>
-------------------------------------------------------------------------------
Excl Trigger ==>
Incl Trigger ==>
|
I fixed also the capitalization problem ..
note that now the syntax for the from and to strings is the same as the one used for the CHANGE command
do You want me to upload the whole shebang again ? |
|
| Back to top |
|
 |
mistah kurtz
Active User
Joined: 28 Jan 2012 Posts: 316 Location: Room: TREE(3). Hilbert's Hotel
|
|
|
|
Hi Enrico
I'm still learning..so probably you can ignore my naïveté, which led me to post that comment.
| Quote: |
| do You want me to upload the whole shebang again ? |
No..that's not required..I can take it from here :-)
Thanks again !! |
|
| Back to top |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10902 Location: italy
|
|
|
|
did You notice the smiley
since it' s already done I will upload it again,
the changes spread a bit all over, it will be easier for You to have the whole picture |
|
| Back to top |
|
 |
mistah kurtz
Active User
Joined: 28 Jan 2012 Posts: 316 Location: Room: TREE(3). Hilbert's Hotel
|
|
|
|
Yup..I did notice the smiley..but looking at your code(and then mine) made me say that :-)
| Quote: |
| since it' s already done I will upload it again |
That would be great :-) |
|
| Back to top |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10902 Location: italy
|
|
|
|
| deleted |
|
| Back to top |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10902 Location: italy
|
|
|
|
here is a modified and enhanced version
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: |
/* 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: |
/* 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: |
)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: |
)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: |
)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: |
)DEFAULT )&?!<|>
)CM
)BLANK
Process : &coun
)BLANK 2
|
the support panel
| Code: |
)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: |
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
 |
|
| Back to top |
|
 |
mistah kurtz
Active User
Joined: 28 Jan 2012 Posts: 316 Location: Room: TREE(3). Hilbert's Hotel
|
|
|
|
Hi Enrico..this looks great..thanks a lot..  |
|
| Back to top |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10902 Location: italy
|
|
|
|
the inclSTR/exclSTR processing is pretty dumb ( just a basic behavior )
entering the INCLUDE STRING will process only the members where the <inclSTR> is found
the other way around for the EXCLUDE STUFF |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|