Some time ago I made some changes in a rexx I found on the CBT tape (I'm
sorry not to know the author's name). It searches for a given string in all
datasets that match a given dataset name pattern and/or allocated on volumes
that match a given volser pattern. I use this JCL:


//T1AI$RCG JOB (CA-IT,50150,36110),'BSM: Tisler',CLASS=Y,
//             MSGCLASS=Q,MSGLEVEL=(1,1),NOTIFY=&SYSUID
//* -----------------------------------------------------------------
//STEP010 EXEC PGM=IKJEFT1A,
//             PARM='ISPF CMD(%FINDSRCL)',
//             TIME=1440
//STEPLIB  DD  DISP=SHR,DSN=SYS1.REXX.SEAGLMD
//ISPPROF  DD  LRECL=80,BLKSIZE=0,RECFM=FB,DSORG=PO,
//             DISP=(,DELETE),
//             SPACE=(TRK,(1,1,4))
//ISPMLIB  DD  DISP=SHR,DSN=ISP.SISPMENU
//         DD  DISP=SHR,DSN=ISF.SISFMLIB
//ISPPLIB  DD  DISP=SHR,DSN=ISP.SISPPENU
//         DD  DISP=SHR,DSN=ISF.SISFPLIB
//ISPSLIB  DD  DISP=SHR,DSN=ISP.SISPSENU
//         DD  DISP=SHR,DSN=ISP.SISPSLIB
//ISPTLIB  DD  DISP=SHR,DSN=ISP.SISPTENU
//         DD  DISP=SHR,DSN=ISF.SISFTLIB
//SYSEXEC  DD  DISP=SHR,DSN=myuserid.REXX.CEXEC
//SYSTSIN  DD  *
sx03
2
xr%8%% sys1.**
/*
//SYSTSPRT DD  SYSOUT=*
//
3
sys1.p*r*lib*.**
//*
sys4.p*r*lib
//*
ISP.V1R2M3
-----------------------------------


to execute the rexx procedure (there could be problems with "!" instead of
"|"): 



/* ----------------------------- Rexx ----------------------------- */
/* Function   : Search for a string in PO, PO-E, PS data sets       */
/*              using ISRSUPC (SearchFor ISPF utility)              */
/*              with following parameters:                          */
/*                   SRCHCMP  - search (??)                         */
/*                   ANYC     - any case                            */
/*                   NOSUMS   - no summary listing section          */
/*                   LMTO     - list group member totals only       */
/* ---------------------------------------------------------------- */
 
Version = "0.02.01 / 19.01.2005"
say
say 'Search for a string, version' Version
say
 
/* ---------------------------------------------------------------- */
/* This rexx looks for a string depending upon given volume or      */
/* data set pattern. It uses ISPF LM utilities.                     */
/*                                                                  */
/* LMDLIST is used to fetch all the dataset getting qualified for   */
/*         given input.                                             */
/* LMMLIST is used for getting all the members of a partitioned     */
/*         dataset.                                                 */
/*                                                                  */
/* It takes a string and 'pattern of dataset or volume' as input    */
/* and lists all datasets matching the pattern or given volume. If  */
/* organisation of a dataset is 'PO' it list all the members and    */
/* find given string in them . It searches all sequential and       */
/* partitioned data set matching a given pattern or volume.         */
/*                                                                  */
/* Dataset pattern can be given like userid.*.* or anyname.p*.q*    */
/*                                                                  */
/* The following data sets will be searched:                        */
/*                                                                  */
/*   PS, PDS, PDSE dataset organization and                         */
/*   F, FB, FBA, V, VB, VBA record format                           */
/*                                                                  */
/* ---------------------------------------------------------------- */
 
/* ---------------------------------------------------------------- */
/* Initialization of variables                                      */
/* ---------------------------------------------------------------- */
 
String = ''
VolName = ''
DSName = ''
 
SAY ' ------------------------------------------------------------------'
SAY ' This rexx searches for a given string in all PS, PO, AND PO-E data'
SAY ' sets matching a given data set name pattern and/or residing on the'
SAY ' volumes matching a given volser pattern.'
SAY ' ------------------------------------------------------------------'
SAY ' '
 
SAY 'Enter the string to be searched for (without quotes)'
PULL String
 
SAY ' '
SAY 'Please enter one of the following:'
SAY '  1 - search all data set(s) on volume(s)'
SAY '  2 - search data set(s) on volume(s)'
SAY '  3 - search data set(s)'
SAY '  4 - quit'
PARSE PULL Option
SAY ' '
 
StartTime = sysvar('SYSCPU')
call time('R')
 
/* ---------------------------------------------------------------- */
/*  Get search parameters                                           */
/* ---------------------------------------------------------------- */
 
  SELECT
    WHEN Option = 1 THEN DO
      SAY 'Search volume(s)'
      PARSE PULL VolName
      SAY 'Searching "'VolName'"'
       IF VolName = '' THEN EXIT
    END
    WHEN Option = 2 THEN DO
      SAY 'Please enter volume and dataset pattern separated by blank'
      PARSE PULL Temp1
      IF WORDS(Temp1) /= 2 THEN DO
        SAY 'Parameters not supplied'
        EXIT
      END
     ELSE
       PARSE VAR Temp1 VolName DSName
    END
    WHEN Option = 3 THEN DO
      SAY 'Search dataset(s)'
      SAY 'Please enter dataset pattern'
      PARSE PULL DSName
      IF DSName = '' THEN DO
        SAY 'Dataset pattern or name not supplied'
        EXIT
      END
    END
    OTHERWISE DO
      SAY 'Ending the program'
      EXIT
    END
  END
 
/* ---------------------------------------------------------------- */
/*  Write the search parameters                                     */
/* ---------------------------------------------------------------- */
 
  SAY
  SAY 'Input data'
  SAY '  String:          'String
  SAY '  Volume pattern:  'VolName
  SAY '  Dataset pattern: 'DSName
  SAY
 
/* ---------------------------------------------------------------- */
/*  Write run date and time                                         */
/* ---------------------------------------------------------------- */
 
call Time 'Reset'
parse value date('S') time('N'),
      with  TodayYYYYMMDD TodayTime,
            1   TodayYear  5  TodayMonth 7  TodayDay .,
            1 . TodayHour ':' TodayMin  ':' TodaySec .
say 'Execution date and time:' TodayDay'.'TodayMonth'.'TodayYear ,
    TodayHour':'TodayMin':'TodaySec; say
 
/* ---------------------------------------------------------------- */
/* Initialize the appropriate function                              */
/* ---------------------------------------------------------------- */
 
  SELECT
    WHEN Option = 1 THEN DO         /* Get dataset id for LMDLIST */
      ADDRESS ISPEXEC 'LMDINIT LISTID(ID) VOLUME('VolName')'
        IF RC /= 0 THEN EXIT
    END
    WHEN Option = 2 THEN DO
      ADDRESS ISPEXEC 'LMDINIT LISTID(ID) VOLUME('VolName') LEVEL('DSName')'
        IF RC /= 0 THEN EXIT
    END
    WHEN Option = 3 THEN DO
      ADDRESS ISPEXEC 'LMDINIT LISTID(ID) LEVEL('DSName')'
        IF RC /= 0 THEN EXIT
    END
    OTHERWISE
     NOP
  END
 
/* ---------------------------------------------------------------- */
/* Allocate files used by ISRSUPC                                  */
/* ---------------------------------------------------------------- */
 
  RetRC = 0
  "ALLOC FILE(SYSIN) UNIT(SYSALLDA) NEW TRACKS SPACE(1,1) DELETE",
        " REUSE LRECL(80) RECFM(F B) BLKSIZE(3120)"
  QUEUE "LNCT 999999"                 /* Line count    */
  "EXECIO 1 DISKW SYSIN "
  QUEUE "SRCHFOR '"String"'"          /* Search string */
  "EXECIO 1 DISKW SYSIN  (FINIS"
   "ALLOC FI(OUTDD) DA(*)"
 
/* ---------------------------------------------------------------- */
/* Loop through the dataset list                                    */
/* ---------------------------------------------------------------- */
 
  CALL GetDataset
  DO WHILE RetRC = 0
    IF RetRC /= 0 THEN
       LEAVE
    IF ((ZDLDSORG = 'PO' ! ZDLDSORG = 'PO-E') &,
        ZDLRECFM /= 'U    ') ! (ZDLDSORG = 'PS') THEN
      CALL SearchFor
    ELSE
      SAY Line 'N/A'
   CALL GetDataset
  END
 
    ADDRESS ISPEXEC 'LMDFREE LISTID('ID')'
 
  EndTime = sysvar('SYSCPU')
  say; say 'This took me ' !! (EndTime - StartTime) !! ' CPU seconds.'
  say '(elapsed time: ' format(time('E'),,3) 'seconds)'
EXIT
 
/* ---------------------------------------------------------------- */
/* Subroutine definitions:                                          */
/* ---------------------------------------------------------------- */
 
  GetDataset :               /* Get qualified datasets
                                from list in variable 'DSName' */
    ADDRESS ISPEXEC 'LMDLIST LISTID('ID') OPTION(LIST) ,
                DATASET(DSName) STATS(YES)'
    RetRC = RC
    IF RetRC = 4 THEN DO
      SAY 'No data set found on basis of volume or pattern'
      EXIT
    END
    ELSE
      IF RetRC /=8 THEN
        Line = 'DSName: '!!SUBSTR(DSName,1,44)!!', VolSer: '!!ZDLVOL!!',
Org: '!!,
            ZDLDSORG!!', Type: '!!ZDLDSNTP!!', RECFM: '!!ZDLRECFM
      ELSE
        NOP
  RETURN                     /* GetDataset subroutine          */
 
/* ---------------------------------------------------------------- */
/*  Search a single PS or an whole library                          */
/* ---------------------------------------------------------------- */
 
  SearchFor :
    ADDRESS TSO
    "ALLOC DA('"DSName"') FI(NEWDD) SHR REU VOL("ZDLVOL")"
    SeqRC = RC
    IF SeqRC /= 0 THEN DO
      SAY 'File' DSName 'could not be allocated for search'
      SAY 'Return code =' SeqRC
      RETURN
    END
 
   ADDRESS ISPEXEC "SELECT PGM(ISRSUPC)" ,
         "PARM(SRCHCMP,ANYC,NOSUMS,LMTO)"
   SearchRC = RC
   IF SearchRC = 0 THEN
     SAY Line 'No matches'
   ELSE IF SearchRC = 1 THEN
     SAY Line 'Data found'
   ELSE
     SAY Line 'Empty DS?'
  RETURN                     /* SearchFor subroutine           */


----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to