Jim,

I'm trying to understand what you want.  I took some existing code I
wrote ages ago in REXX and modified it to do this function:

"Search all members of a PDS for a string of text where the member name
matches both a PRE and SUF"

I hope this is what you were looking for, I'm not sure I understood your
intent from your email.  It's in native TSO REXX, called from a JCL step
in batch.  This example looks for all JCL comment lines in
MY.PDS.LIBRARY by calling the SRCHPDS member of REXX library
WHERE.YOU.PUT.YOUR.SRCHPDS.REXX :

//* THIS JOB WILL SEARCH PDS LIBRARIES FOR DATA
//* THIS ONE ALLOWS MEMBER NAME PATTERNS WITH A PREFIX AND SUFFIX
//*
//SRCHPDS  EXEC    PGM=IKJEFT01
//SYSTSPRT DD SYSOUT=*
//SYSEXEC  DD DSN=WHERE.YOU.PUT.YOUR.SRCHPDS.REXX,DISP=SHR
//SYSTSIN  DD *
 SRCHPDS MY.PDS.LIBRARY PRE(ABC) SUF(XYX) FIND(//*)

/* REXX - SRCHPDS MEMBER */
/* SEARCH A PDS WITH MEMBER NAME WITH PDSPRE PREFIX, PDSSUF SUFFIX, FOR
FINDSTR*/
TRACE O
ARG PDSDSN "PRE(" PDSPRE ")" "SUF(" PDSSUF ")" "FIND(" FINDSTR ")" .
PDSDSN = STRIP(PDSDSN)
PRELEN = LENGTH(PDSPRE)
SUFLEN = LENGTH(PDSSUF)
IF LISTDSI("'"PDSDSN"'") = 0 & SYSDSORG = 'PO' THEN
DO
 CALL OUTTRAP 'LDS.'
 "LISTDS '"PDSDSN"' MEMBERS"
 CALL OUTTRAP 'OFF'
END
ELSE DO
 SAY 'LISTDSI FUNCTION FAILED'
 EXIT
END

DO MBR = 7 TO LDS.0
  LDS.MBR = STRIP(LDS.MBR)
  IF LEFT(LDS.MBR,PRELEN) = PDSPRE & RIGHT(LDS.MBR,SUFLEN) = PDSSUF THEN
  DO /* MEMBER NAME MATCHED PREFIX AND SUFFIX, SEARCH IT */
   "ALLOC F(DD1) DA('"PDSDSN"("LDS.MBR")') SHR REUSE"
   "EXECIO * DISKR DD1 (FINIS STEM LINES."
   SAY 'SEARCHING MEMBER' LDS.MBR /* COMMENT OUT IF YOU DONT NEED THIS
*/
   X = 0 /*ZERO FIND COUNT*/
   DO Z = 1 TO LINES.0
     IF POS(FINDSTR,LINES.Z) > 0 THEN
     DO
      SAY LINES.Z /*REPORT MATCHING LINE*/
      X = X + 1   /*ACCUMULATE FIND COUNT FOR CURRENT MEMBER*/
     END
   END Z
   IF X > 0 THEN SAY X" LINE(S) CONTAINED '"FINDSTR"' IN MEMBER "LDS.MBR
   "FREE F(DD1)"
   DROP LINES.
  END
END
EXIT


Hope this helps.

Best wishes,

Gary Diehl
Systems Administration
"One machine can do the work of fifty ordinary people. No machine can do
the work of one extraordinary person." -Elbert Hubbard

----------------------------------------------------------------------
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