Problem solve Get help with specific problems with your technologies, process and projects.

Member search in all user libraries

Learn about Rexx programs and how the results are stored in this tip.

Rexx programs generate all members in all user libraries. Scheduled Rexx command stores results in a PF.

You can search members with DFU. External routines: CPYTOREXQ ( Read File to REXX QUEUE)

 		 
Rexx Source:
/* Search member in all user library */ 
 WorkLIb = 'your work library'
 OutMbr = 'LIBSEARCH'
 OutLIB = 'your library'
 call SEARCH_LIST_GENERATOR
'DLTF FILE('OutLIb'/'OutMbr')'
'CRTPF FILE('OutLIB'/'OutMbr') SRCFILE(QGPL/....)',
    'SRCMBR(LIBSEARCHD) SIZE(*NOMAX)'
'OVRDBF FILE(STDOUT) TOFILE('OutLIB'/'OutMbr') MBR('OutMbr')'
'CPYTOREXQ FROMFILE('WorkLIb'/XSRC) MBR(XSRC) NMBRCDS(*ALL)'
 If queued() = 0 then do
    say 'SEARCH DATABASE NOT FOUND'
    exIt
 end
 KQX = queued() -1
 /* say 'Number of Member:' KQX */
 do I = 1 to KQX
     pull LIneX.I
 end
'RMVREXBUF'
 NumberOfLIb = 0
 NumberOfFILE = 0
 PrevLIB = ''
 PrevFILE = ''
 do J = 1 to KQX
     LIneX.J = substr(LIneX.J,14,60)
     If strIP(LINEX.J) = '' then Iterate
     LIb = strIP(word(LIneX.J,2))
     LIb = left(LIb,12)
     If LIB <> PrevLIB then do
          PrevLIB = LIB
          NumberOfLIB = NumberOfLIB + 1
     end
     If FILE <> PrevFILE then do
          PrevFILE = FILE
         NumberOfFILE = NumberOfFILE + 1
     end
     If pos('*', LIB) > 0 then Iterate
     FIle = strIp(word(LIneX.J,1))
     FIle= left(FIle,12)
     If pos('*', FILE) > 0 then Iterate
     Member = word(LIneX.J,7)
     Member = strIp(substr(Member,4,12))
     Member = left(Member,12)
     If strIp(Member) = '' then Iterate
     QLINE = left(Member''LIB''FIle,36)
     If strIp(QLINE) = '' then do
          Iterate
     end
     say QLINE
 end
 exIt

/************************************************************/
SEARCH_LIST_GENERATOR:
'CLRPFM FILE('WorkLIB'/XSRC) MBR(XSRC)'
'QSYS/DSPFD FILE(*ALLUSR/*ALL) TYPE(*MBRLIST) OUTPUT(*OUTFILE)',
        'OUTFILE('WorkLIb'/XSRC) OUTMBR(XSRC *REPLACE)'
return




---------------------------------------
PF -DDS Source:

     A          R MAB13
     A            MEMBER        12
     A            LIBRARY       12
     A            FILE          12
     A          K MEMBER
---------------------------------------
SEARCH CLP Source:
PGM
STRDFU OPTION(5 *NONE) FILE(Your Library/LIBSEARCH)
ENDPGM 

This was last published in January 2002

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchDataCenter

Close