Searchfor a string in 2 or 3 pds in rexx

IBM's Command List programming language & Restructured Extended Executor

Re: Searchfor a string in 2 or 3 pds in rexx

Postby willy jensen » Fri Aug 02, 2019 1:44 am

if you really insist on asking for datasets, then something like this could be used, as NicC suggested instead of running the REXX multiple times:
member = 'IHASDWA'                              
 do until fds<>''                                
   say 'Enter libname'                            
   pull ds                                        
   if ds='X' then exit 0                          
   if sysdsn("'"ds"("member")'")='OK' then fds=ds
   say member 'not found in' ds                  
 say member 'is in' fds
willy jensen
Posts: 316
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 42 times

Re: Searchfor a string in 2 or 3 pds in rexx

Postby NicC » Fri Aug 02, 2019 1:59 pm

Or - outline program structure:-

stem of items to find
stem of places to look
Do to_find_index = 1 to max items to find
   Do places_index = 1 To max places to look
      If item in place
      Then Do
         Say found
         set places_index to max places to look

If this is just a coding exercise then this will do but if you really are looking in Endevor for places that items exist then Endevor has builtin utilities for doing this search.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Global moderator
Posts: 3026
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times


Return to CLIST & REXX


  • Related topics
    Last post