FINDMEM: Find a member in a data set list

If you need to find which data sets within a data set list contain a member, use the exec shown below on any DSLIST command line.

This exec can be used as a model for other programs that need to search the current data set list. It uses some internals that are, of course, subject to change, but the basics haven't changed in many years.

This function is superceded by ISPF's built-in MEMBER command.

Syntax:

 TSO FINDMEM pattern

 where pattern is a member name or member pattern.

Output:

Output of FINDMEM command
   Menu  Options  View  Utilities  Compilers  Help 
 ------------------------------------------------------------------------------
 DSLIST - Data Sets Matching NADEL                                 Row 1 of 256
 Command ===>  TSO FINDMEM SETUP                                Scroll ===> CSR
 
 Command - Enter "/" to select action                  Message           Volume
 -------------------------------------------------------------------------------
           -  -  -  -  -  -  -  -  -  -  -  -       33 data set(s) not displayed
          NADEL.CLIST                                   FOUND: SETUP     PRM908
           -  -  -  -  -  -  -  -  -  -  -  -      156 data set(s) not displayed
          NADEL.PRIVATE.PLS                             FOUND: SETUP     PRM914
           -  -  -  -  -  -  -  -  -  -  -  -       65 data set(s) not displayed
 ***************************** End of Data Set list ****************************

Source: (use cut and paste to save this to a local file)

 

Source for FINDMEM
/* Rexx  find which data sets in a dslist contain a member           */
/*       Syntax: Tso findmem pattern                                 */
/*       where pattern is a name or pattern with % And * Characters  */
/*       requires ISPF 4.5+              Doug nadel 6/2001           */
/*       ** Uses some undocumented or unsupported methods ***        */
Parse Upper Arg pattern .
If pattern="" Then                     /* Insure parm was passed     */
  Do
    Say "No member pattern specified"
    Exit
  End
dta = ptr(76+ptr(ptr(24+ptr(112+ptr(132+ptr(540))))))
tname=storage(d2x(dta+196),8)          /* Get dslist table name      */
If substr(tname,1,3)="DSL" & "NUM"=datatype(delstr(tname,1,3)) Then
  Do
    Address ispexec
    "CONTROL ERRORS RETURN"            /* Trap errors                */
    "TBTOP  "tname                     /* Move to top of table       */
    "TBSKIP "tname                     /* Go to 1st row              */
    Do While rc=0                      /* Loop through rows          */
      zudxstat="Y"                     /* Exclude the line           */
      If zudvol \= "MIGRAT" & substr(zudvol,1,1)\= "*" Then
        Do                             /* If online real dataset     */
          "LMINIT DATAID(MS) DATASET('&ZUDSNS') ENQ(SHR) ORG(DSO)"
          If rc=0 Then                 /* Allocated?                 */
            Do
              If dso="PO" Then         /* Known pds or pdse          */
                Do
                  check=""             /* Init for LMMLIST           */
                  "LMOPEN DATAID(&MS) OPTION(INPUT)" /* Open the ds  */
                  If rc=0 Then         /* Open OK?                   */
                    If pos("*",pattern)>0 | pos("%",pattern)>0 Then
                      "LMMLIST DATAID(&MS) MEMBER(CHECK) ",
                        "PATTERN(&PATTERN) OPTION(LIST)"
                    Else
                      "LMMFIND DATAID(&MS) MEMBER(&PATTERN) "
                  If rc=0 Then         /* If found                   */
                    Do
                      zudxstat="N"     /* Unexclude list             */
                      zulmsg="07"x||"FOUND: "pattern /* Set message  */
                    End
                End
              "LMFREE DATAID(&MS)"     /* Free the allocation        */
            End                                                         
        End
      "TBPUT  "tname                   /* Update the table           */
      "TBSKIP "tname                   /* Move to next row           */
    End
    "CONTROL NONDISPL ENTER"           /* Force refresh              */
  End
Else
  Say " The data set list table could not be found "
Return

ptr:Return c2d(storage(d2x(Arg(1)),4))