Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

REXX Member list 2

Status
Not open for further replies.

SowKan

Technical User
Mar 18, 2004
24
IN
I need to list out all the members in a PDS which matches my search string. Say in MYPDS I search for LIS*, all the members starting from LIS like LISPGM, LISCAT,LISTWM, etc,...should be the output. One way to do this is to submit a SRCHFOR job from my REXX EXEC. However I don't want to do this as this would take time and I need to wait until the job finishes. Is there any other way or utility in REXX to do this?
 
Hi SowKan,

Take a look at the last couple of posts in thread277-781654 for a few options. I'm not sure off the top of my head how to restrict the list to certain members but I'm sure you can look it up.

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
 
The following code presumes you have a list of words (mbrlist) and a search-argument (memmask) where asterisks represent positions which may be any character:
Code:
memmask = Strip(memmask,"T","*")"*"
maskl   = Length(memmask)
lomask  = Translate(memmask, '00'x , "*")
himask  = Translate(memmask, 'FF'x , "*")
do Words(mbrlist)                /* each membername            */
   parse var mbrlist mbr mbrlist
   if BitAnd(himask,Left(mbr,maskl)) = ,
       BitOr(lomask,Left(mbr,maskl)) then,
      mbrlist = mbrlist mbr
end                              /* words                      */

At the end of this code, (mbrlist) will contain only words which matched the search argument.

Frank Clarke
Tampa Area REXX Programmers' Alliance
REXX Language Assn Listmaster
 
Here is a sample code to list out members from a PDS that match your criteria

/*rexx*/
dsn = "MY.PDS"
DUMMY =OUTTRAP("MEMB.","*")
"LISTDS '"dsn"' MEMBERS"
do i = 1 to memb.0
if SUBSTR(strip(memb.i),1,3) = 'LIS' then
say "memeber :" memb.i
end

Hope this helps
 
If ISPF is active, you could do this;
Code:
dataset = 'MY.DATA.SET'
Address 'ISPEXEC'
"LMInit Dataid(DATAID) Dataset('"dataset"') Enq(SHR)"
if rc > 0 then return 0
"LMOpen Dataid("dataid")"
if rc > 0 then do
  "LMFree Dataid("dataid")"
  return 0
end
srchpat = 'A%CD*'
"LMMList Dataid("dataid") Option(LIST) Member(MEMNAME)" ,
    "Pattern("srchpat")"
do while rc = 0
  say 'Found member 'memname
  "LMMList Dataid("dataid") Option(LIST) Member(MEMNAME)" ,
      "Pattern("srchpat")"
end
"LMClose Dataid("dataid")"
if rc > 0 then do
  "LMFree Dataid("dataid")"
  return 0
end
"LMFree Dataid("dataid")"
if rc > 0 then return 0
return 1
This would allow you to use ISPF member wildcard patterns.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top