View previous topic :: View next topic
Author
Message
SCARCEBOYZ New User Joined: 16 May 2005Posts: 32 Location: Millenium Business Park, Mumbai
Hello All,
Could anybody explain me how can I apply ReNUM;Unnum TSO command for all the PDS members in one go rather tha changing it one by one.
Thanks,
Vivek Tripathi
Back to top
ofer71 Global Moderator Joined: 27 Dec 2005Posts: 2358 Location: Israel
RENUM and UNNUM are not TSO commands; they are ISPF Edit Command.
You can write a REXX to loop through all members in a PDS, then execute and ISPF Edit Macro against each member.
Search the forum for planty of examples.
O.
Back to top
enrico-sorichetti Superior Member Joined: 14 Mar 2007Posts: 10891 Location: italy
here is a working sample
Code:
/* comment $apply is an edit macro which will apply the edit macro passed as a
/* comment parameter to all the member of a pds
/* comment to use it .... open a new, emty pds member and..
/* comment type in the command line "$APPLY name_of_the_macro"
/* comment
/* comment included are 3 samples
/* comment
/* comment $UNPACK.. the name tells
/* comment $RENUM...
/* comment $UNNUM
/* comment
/*REXX - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* $APPLY */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
Trace "O"
Parse Source _system _called _commnd .
If Sysvar(SYSISPF) /= "ACTIVE" Then Do
Say left(_commnd,8)"- Ispf is not active. Command not executed"
Exit 4
End
call $init_
call $ispex "CONTROL ERRORS RETURN"
if $isred("MACRO (ZPARMS) NOPROCESS ") = 0 then do
_parms = strip(translate(zparms))
end
else do
zerrsm = "Invocation ERROR"
zerrlm = left(_commnd,8)"- Must be invoked as an edit macro"
call $ispex "SETMSG MSG(ISRZ002) "
Exit 1
end
call getopt_
if _help then do
call $ispex "DISPLAY PANEL("zerrhm") "
exit 1
end
If _parms = "" Then do
zerrsm = left(_commnd,8)"- No Parms"
zerrlm = left(_commnd,8)"- Enter The 'MACRO' to be run ....."
call $ispex "SETMSG MSG(ISRZ002) "
Exit 1
end
macro = _parms
call $isred "(DATASET) = DATASET"
call $isred "(CURRNT) = MEMBER"
call $isred("(DATAID) = DATAID" )
call $isred("DELETE .ZFIRST .ZLAST" )
lmo_rc = $ispex("LMOPEN DATAID("dataid") OPTION(INPUT) ")
count = 0
member = ""
lmmlist = "LMMLIST DATAID("dataid") OPTION(LIST) MEMBER(MEMBER) "
do while 0 = $ispex(lmmlist)
if strip(member) /= strip(currnt) then do
done = "EDITED"
edit = "EDIT DATAID("dataid") MEMBER("member") MACRO("macro") "
zrc = $ispex(edit)
if zrc = 0 then ,
done = "SAVED"
else if zrc = 4 then ,
done = "NOT SAVED RC("zrc") "
else ,
done = "UNEXPECTED RC("zrc") "
count = count + 1
line = dataset"("member")"
call $isred "LINE_AFTER " Line " = DATALINE (LINE) "
end
else ,
done = "NOT SELECTD"
line = left(done,13) dataset"("member")"
call $isred "LINE_AFTER .ZLAST = DATALINE (LINE) "
end
lmo_rc = $ispex("LMMLIST DATAID("dataid") OPTION(FREE) " )
lmo_rc = $ispex("LMCLOSE DATAID("dataid") " )
if _endmsg then do
zedsmsg = left(_commnd,8)"- Done "count
zedlmsg = left(_commnd,8)"- " || Count || " Members Modified"
call $ispex "SETMSG MSG(ISRZ000) "
exit 1
end
Exit
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
$init_:
ini_0tr = trace("O")
_help = 0
_endmsg = 1
zerralrm = "YES"
zerrhm = "ISR2MACR"
_plis.0 = 2
_plis.1 = "? H HELP"
_pset.1 = "_help = 1"
trace value(ini_0tr)
return
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
$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
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
getopt_:
opt_0tr = trace()
do _l = 1 to _plis.0
_parm._l = ""
do _w = 1 to words(_plis._l)
_p = wordpos(word(_plis._l,_w),_parms)
if _p /= 0 then do
if _parm._l = "" then do
_parm._l = strip(word(_parms,_p))
if symbol("_pset._l._w") = "VAR" then ,
interpret _pset._l._w
else ,
interpret _pset._l
end
_parms = delword(_parms,_p,1)
end
end
end
Trace value(opt_0tr)
return
/*REXX - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* $UNPACK */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
Trace "O"
Parse Source _system _called _commnd .
If Sysvar(SYSISPF) /= "ACTIVE" Then Do
Say left(_commnd,8)"- Ispf is not active. Command not executed"
Exit 4
End
call $init_
call $ispex "CONTROL ERRORS RETURN"
if $isred("MACRO (ZPARMS) NOPROCESS ") = 0 then do
_parms = strip(translate(zparms))
end
else do
zerrsm = "Invocation ERROR"
zerrlm = left(_commnd,8)"- Must be invoked as an edit macro"
call $ispex "SETMSG MSG(ISRZ002) "
Exit 1
end
call $isred "(PACK) = PACK "
if pack = "ON" then do
call $isred "PACK OFF"
call $isred "END"
end
else do
call $isred "CANCEL"
end
Exit
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
$init_:
ini_0tr = trace("O")
zerralrm = "YES"
zerrhm = "ISR2MACR"
ini_0rc = 0
trace value(ini_0tr)
return ini_0rc
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
$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
/*REXX - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* $RENUM */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
Trace "O"
Parse Source _system _called _commnd .
If Sysvar(SYSISPF) /= "ACTIVE" Then Do
Say left(_commnd,8)"- Ispf is not active. Command not executed"
Exit 4
End
call $init_
call $ispex "CONTROL ERRORS RETURN"
if $isred("MACRO (ZPARMS) NOPROCESS ") = 0 then do
_parms = strip(translate(zparms))
end
else do
zerrsm = "Invocation ERROR"
zerrlm = left(_commnd,8)"- Must be invoked as an edit macro"
call $ispex "SETMSG MSG(ISRZ002) "
Exit 1
end
call $isred "(NUMB) = NUMBER"
numb = translate(strip(word(numb,2)))
if numb = "OFF" then ,
call $isred "NUMBER ON"
call $isred "RENUM"
call $isred "END"
Exit
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
$init_:
ini_0tr = trace("O")
zerralrm = "YES"
zerrhm = "ISR2MACR"
ini_0rc = 0
trace value(ini_0tr)
return ini_0rc
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
$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
/*REXX - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* $UNNUM */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
Trace "O"
Parse Source _system _called _commnd .
If Sysvar(SYSISPF) /= "ACTIVE" Then Do
Say left(_commnd,8)"- Ispf is not active. Command not executed"
Exit 4
End
call $init_
call $ispex "CONTROL ERRORS RETURN"
if $isred("MACRO (ZPARMS) NOPROCESS ") = 0 then do
_parms = strip(translate(zparms))
end
else do
zerrsm = "Invocation ERROR"
zerrlm = left(_commnd,8)"- Must be invoked as an edit macro"
call $ispex "SETMSG MSG(ISRZ002) "
Exit 1
end
call $isred "(NUMB) = NUMBER"
numb = translate(strip(word(numb,2)))
if numb = "OFF" then ,
call $isred "NUMBER ON"
call $isred "RENUM"
call $isred "END"
Exit
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
$init_:
ini_0tr = trace("O")
zerralrm = "YES"
zerrhm = "ISR2MACR"
ini_0rc = 0
trace value(ini_0tr)
return ini_0rc
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
$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
Back to top
SCARCEBOYZ New User Joined: 16 May 2005Posts: 32 Location: Millenium Business Park, Mumbai
Thanks a lot e.s.
This is what I was looking for. Could you please tell me how to install this Rexx and use it for changes as I hav'nt used any Rexx tool before.
Thanks in advance
Vivek
Back to top
enrico-sorichetti Superior Member Joined: 14 Mar 2007Posts: 10891 Location: italy
in a library in Your sysproc concatenation create the 4 members
test them on a copy of Your real data
Back to top
Please enable JavaScript!