× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I am trying to write a SQL Stored Procedure but am having no luck getting to 
work. I have written them before and this smells like another complier bug.

Each time that I try to run this stored procedure, I keep getting a message 
saying that everyone of the tables is not found in QGPL if I use QGPL as the 
default collection and my library MP1CAMPIA if I do not specify a default 
collection. All the libraries are on the library list as well as being added to 
Set Path statement but it keeps trying to find them in the default collection. 
What gives? This is driving me crazy. If you don't specify a collection, 
doesn't it use the library list?

Anyway thanks.  

    SET DTA_LIBRARY = 'A1' CONCAT INCOMPANYCODE CONCAT 'DTA' ;   
    SET AMO_LIBRARY = 'A1AMODTA';                                
                                                                 
    SET PATH DTA_LIBRARY, AMO_LIBRARY;                           
                                                                 
    SET STMT = 'CRTDUPOBJ OBJ(QAQQINI) FROMLIB(MP1CAMPIA)        
                  OBJTYPE(*FILE) TOLIB(QTEMP) DATA(*YES) ' ;     
    SET STMTLENGTH = LENGTH ( STMT ) ;                           
    CALL QSYS/QCMDEXC ( STMT , STMTLENGTH ) ;                    
                                                                 
    Update QTEMP/QAQQINI                                         
       SET QQVAL = '*YES' WHERE QQPARM = 'FORCE_JOIN_ORDER' ;    
                                                                 
    SET STMT = 'CHGQRYA QRYOPTLIB(QTEMP)' ;                      
    SET STMTLENGTH = LENGTH ( STMT ) ;                           
    CALL QSYS/QCMDEXC ( STMT , STMTLENGTH ) ;                    
                                                                 
    Sel: Begin                                                   
      Declare c1 Cursor With Return For                          
        Select RFPAYC,
               RFRFNN,                                            
               RFDATE,                                            
               RFAMT,                                             
               CMPCMPY,                                           
               CMPNAME                                            
        From OPMRFPF1                                             
          Inner Join OPMHDRF1                                     
            On RFORDN = HDORDN                                    
          Inner JOIN MFMDIVF1                                     
            On HDODIV = DIVDIV                                    
          Inner JOIN MFMCMPF1                                     
            On DIVCMPY = CMPCMPY                                  
        Where RFRFNN <> 0 And                                     
              RFDATE Between InFromDate and InToDate              
        Order By CMPCMPY;                                         
        Open c1;                                                  
      End Sel;                                                                  
                             



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.