IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to apply a TSO command for all the PDS members


IBM Mainframe Forums -> TSO/ISPF
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
SCARCEBOYZ

New User


Joined: 16 May 2005
Posts: 32
Location: Millenium Business Park, Mumbai

PostPosted: Thu Nov 15, 2007 11:57 am
Reply with quote

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
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Thu Nov 15, 2007 12:39 pm
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Nov 15, 2007 1:37 pm
Reply with quote

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
View user's profile Send private message
SCARCEBOYZ

New User


Joined: 16 May 2005
Posts: 32
Location: Millenium Business Park, Mumbai

PostPosted: Thu Nov 15, 2007 2:02 pm
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Nov 15, 2007 2:09 pm
Reply with quote

in a library in Your sysproc concatenation create the 4 members
test them on a copy of Your real data
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> TSO/ISPF

 


Similar Topics
Topic Forum Replies
No new posts RACF - Rebuild SETROPTS command which... All Other Mainframe Topics 3
No new posts Routing command Address SDSF to other... TSO/ISPF 2
No new posts DTL - how to define key with stacked ... TSO/ISPF 3
No new posts LTJ command CA Products 4
No new posts Query on edit primary command CLIST & REXX 5
Search our Forums:

Back to Top