/* Language -- REXX */ /* Name -- WHEREIS */ /* Purpose -- Search for a given member in library concat. */ /* Author -- John McCarthy, Optimum Data Systems, Inc. */ /* "Locating ISPF Library Members" in "TSO Times" */ /* Summer 1993 issue from Chicago-Soft, Ltd */ /* modifications by David McRitchie -- "The REXX Macros Toolbox" 1993/10/04 */ /* default to exact match, unless new option ANY invoked */ /* preference for SYSDSN to LISTD, uses 4 secs instead of 30 */ /* include DDNAME in display when found */ /* original had 70 lines, this equates to 112 (remaining + 3) */ /*********************************************************************/ trace o parse upper arg fmember op.1 op.2 if fmember = ' ' then do ZEDSMSG = "member?" ZEDLMSG = 'Member was not specified' ADDRESS "ISPEXEC" "SETMSG MSG(ISRZ000)" exit(12) END any = "" address "TSO" "CLS" do i = 1 to 2 if op.i = "ANY" then ANY = "ANY" if datatype(op.i,'n') = 0 then max = op.i end timestart = time('N') say "Time started " timestart "-- TSO WHEREIS" fmember max, "allow at least 30 seconds" if ANY = "ANY" then say " ANY, specified will search for", fmember "as part of membernames" else say " ANY, not specified therefore membername must", "match exactly with" fmember say " nnn, possible termination after nnn hits within dataset" say "--alternative "The REXX Macros Toolbox" clists: ", "clist, panels, loadmod, proc, pdsdd" if max = '' then max = 999 else do if max = "=" then do; max=999; exact=1; end; else if datatype(max,'n') = 0 then do ZEDSMSG = "max" ZEDLMSG = 'Second parameter indicates number', "of hits acceptable -- must be numeric, or '='" ADDRESS "ISPEXEC" "SETMSG MSG(ISRZ000)" exit(12) END END total = 0 /* get concatenation */ x = outtrap("alc.") "listalc status" x = outtrap("off") /* search libraries */ do line = 2 to alc.0 linep1 = line+1 if substr(alc.linep1,1,2)=' ' then if substr(alc.linep1,3,1)\='' then ddname=substr(alc.linep1,3,8) if substr(alc.line,1,1) \= ' ' then do i = pos('(',alc.line) if i=0 then i=pos('?',alc.line) if i = 0 then if substr(alc.line,1,9) \= 'TERMFILE ' then if substr(alc.line,1,9) \= 'NULLFILE ' then if ANY = "" then call quick_scan; else call scan_members end end if total = 0 then do ZEDSMSG = "not found" ZEDLMSG = 'Member' fmember 'was not found' ADDRESS "ISPEXEC" "SETMSG MSG(ISRZ000)" say fmember '-- not found, try one of the other clists' end say "WHEREIS began" timestart "completed" time('N'), "-- TSO WHEREIS" fmember op.1 op.2 /* that's all folks -'- */ exit /* sub-routines */ quick_scan: /* added by D.McRitchie for speed and usage */ x = sysdsn("'"strip(substr(alc.line,1,44))"("fmember")'") if x = "OK" then do total=total + 1 say ddname 'member('fmember') in' alc.line end return scan_members: /*original code, find string anywhere in members*/ x = outtrap("members.") "listd '"alc.line"' MEM" x = outtrap("off") if members.0 < 7 then return flag1 = 0; count=max; do num = 7 to members.0 /* if fmember = substr(members.num,3,8) then do*/ find = 0 if ANY = "ANY" then find = POS(fmember,strip(members.num)) else if fmember = substr(members.num,3,8) then find=1 if find \= 0 then do total = total + 1 if flag1 = 0 then do say left(ddname,8) '-- Dataset --' alc.line, 'members('members.0')' /* say '-- Members --'*/ flag1 = 1 end say ' 'members.num count = count - 1 if count < 1 then do say ' ' say 'Continue? (Y/N)' pull ans; ans=translate(ans) if ans \= 'Y' then exit(2) count = max end end end return