Friday, June 21, 2013

MBRLIST - Print Member List of a PDS to a Flat File

There are times at which You would want to dump the list of members in a PDS Library to a flat file, for Analysis Purpose. The below exec does so. You can enhance upon this one to compare the members of different PDS and so on.

/*---------------------------Rexx----------------------------------*/
/* Atom - May 2013                                                 */
/*-----------------------------------------------------------------*/
/* This Exec Prints the list of members of a PDS into a Flat File  */
/*-----------------------------------------------------------------*/
   Address TSO
   oPrtDS = " "
   inPDS   = " "
   parse arg inPDS
   do while inPDS = " "
      Say "Enter PDS Name Or X to Exit :"
      Parse Upper pull inPDS
   end
   inPDS = strip(inPDS,b)
   inPDS = strip(inPDS,b,"'")
   if inPDS = "X" | inPDS = "x" then exit
   do while oPrtDS = " "
      Say "Enter Print PS Name Or X to Exit :"
      Parse Upper pull oPrtDS
   end
   oPrtDS = strip(oPrtDS,b)
   oPrtDS = strip(oPrtDS,b,"'")
   if oPrtDS = "X" | oPrtDS = "x" then exit
   ScanList  = "'" || oPrtDS || "'"
   PDSName = "'" || inPDS || "'"
   xx = outtrap('ON')
   x=sysdsn(ScanList)
   xx = outtrap('OFF')
   if x = 'OK' then do
      xx = outtrap('ON')
      "delete "ScanList
      xx = outtrap('OFF')
   end
   "alloc F(ScanList) da("ScanList") unit(sysda) space(100,50)" ,
        || " tr dsorg(ps) recfm(F B) lrecl(80) new reuse"
   "execio 0 diskw ScanList (open"
   ScanListRec = " "
   x = outtrap("PDSmemlist.")
   "listds "PDSName" members"
   ScanListRecsNbr = 0
   x = outtrap("off")
   do dummyidx = 1 to PDSmemlist.0
      if PDSmemlist.dummyidx = "--MEMBERS--" then do
          PDSmemlistbeg = dummyidx + 1
          leave
      end
   end
   do PDSmemlistidx = PDSmemlistbeg to PDSmemlist.0
      mbr = strip(PDSmemlist.PDSmemlistidx,b)
      ScanListrec = mbr
      push ScanListRec
      "execio 1 diskw ScanList"
      ScanListRecsNbr = ScanListRecsNbr + 1
   end
   "execio 0 diskw ScanList (finis"
   "free f(ScanList"
return


No comments:

Post a Comment

Popular

Featured

Three Months of Chadhei