ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Search String inside program member

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Search String inside program member

    Hi All,

    Need your expert advice.

    Am writing a small RPG using API QUSLMBR which allow me to produce all members within respective libraries / source PF. I stored the result of the user space into a PF.

    I intend to use this PF (That contain all necessary members) and scan specific string content. Anybody know any API that can help me on this?

    I checked QCLSCAN, but i am not sure if i can just pass in the library, member name and scan? any other idea.

    Other than above; anybody have an example on how to use QDBRTVFD API in RPG? (tried to read the IBM redbook but it is too much information for me)

    Thanks,
    Kwang.

  • #2
    Re: Search String inside program member

    QDBRTVFD

    PHP Code:
    D qdbrtvfd        PR                  ExtPgm('QDBRTVFD')                   retrieve file desc  
    D                            18000    options
    (*varsize)                    RECEIVER VARIAB     
    D                               10i 0 
    const                                RECEIVERfLENGTH     
    D                               20                                         RETRN FILE
    /LIB      
    D                                8    
    const                                TYPE FORMAT         
    D                               20                                         FILE LIB  20        
    D                               10    
    const                                ALL FORMATS         
    D                                1    
    const                                NO OVERRIDES        
    D                               10    
    const                                WHICH SYSTEM        
    D                               10    
    const                                FORMAT TYPE?        
    Db                                    like(vApiErrDS)                      error parm        

     
    // Error return code parm for APIs.                                                            
     //---------------------------------------------------------------                              
    D vApiErrDs       ds                                                                            
    D  vbytpv                       10i 0 inz
    (%size(vApiErrDs))                bytes provided       
    D  vbytav                       10i 0 inz
    (0)                               bytes returned       
    D  vmsgid                        7a                                        error msgid          
    D  vresvd                        1a                                        reserved             
    D  vrpldta                      50a                                        replacement data     
     
    //---------------------------------------------------------------                              


       
    callp  QDBRTVFD(               
              
    vrcvar      :           
              %
    size(vrcvar):          
              
    vrtnfl      :           
              
    'FILD0100'  :           
              
    vfillb      :           
              
    '*ALL      ':           
              
    '0'         :           
              
    '*LCL      ':           
              
    '*EXT      ':           
              
    vApiErrDs);             
                                      
       if  
    vbytav 0;             //ERROR OCCURRED  
          
    vbasedonpf 'NOT FOUND ';  
    else;  
    endif; 
    Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply

    Comment


    • #3
      Re: Search String inside program member

      Hi,

      THanks for the tips. I have one more query that need your help.

      Is this API QDBRTVFD can be use for *ALLUSR/*ALL files?
      I mean when we use DSPFD command we can use DSPFD FILE(*ALLUSR/*ALL).

      The reason i asked because when i put the 'Receiver returned file name' (3rd parameter of QDBRTVFD) as *ALLUSR/*ALL, the command is giving me error code CPF5715 which is LIB/FILE not found.

      Any advice?

      Thanks in advance,
      K

      Comment


      • #4
        Re: Search String inside program member

        i don't think so, it is for a specific file. --> http://publib.boulder.ibm.com/infoce...s/qdbrtvfd.htm

        But if ya want to do that just wrap a retrieval for all files around this and call it for each one.
        Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply

        Comment

        Working...
        X