Find members in a PDS or PDSE, with PACK ON.

Time Sharing Option, Interactive System Productivity Facility and REstructured eXtended eXecutor

Moderator: mickeydusaor

Post Reply
GanModak
New Member
Posts: 1
Joined: Thu Sep 24, 2015 10:09 am

Find members in a PDS or PDSE, with PACK ON.

Post by GanModak »

Hi,

For an issue, I need to identify all members in a dataset with PACK ON in the profile. Tried to do it manually but doing this manually would not be efficient as there are over 90,000 members. Can you please suggest if there is any easy way to do this?

Thanks
William Collins
Global Moderator
Global Moderator
Posts: 490
Joined: Sun Aug 25, 2013 7:24 pm

Re: Find members in a PDS or PDSE, with PACK ON.

Post by William Collins »

List the directory and look at a known PACK on, a known PACK off, and find where the indicator of PACK is. Then list all that are PACK on.
enrico-sorichetti
Global Moderator
Global Moderator
Posts: 826
Joined: Wed Sep 11, 2013 3:57 pm

Re: Find members in a PDS or PDSE, with PACK ON.

Post by enrico-sorichetti »

here is a set of macros that might help

Code: Select all

/* 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
if You just need to know and do nothing
modify the $unpack macro
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort 8-)
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “TSO, ISPF & REXX (Do you still do CLIST?!).”