I appreciate all the help so far.  I have 
  been working on this off and on, and still can not get it to work.  I 
  have made the changes suggested.
   
  1. Override to the OPNID(CS910011) with 
  share(*yes) overscope(*job)
  2. Make the F-spec match the OPNID
  3. Put the K in the F-spec
   
  I run a query on the remote system (with same 
  selection) and get records.
   
  How do I test if I have records?  I have 
  tried the CPYFRMQRYF command, it won't work due to DDM.
   
  The opnqryf runs with out errors.  I have 
  verified the qryslt parm, looks good.  I put the RPG in debug.  The 
  program reads the file and sets on EOF on first read (therefore I do not have 
  any records) and ends the program.
   
  Any more thoughts would be 
  appreciated.
   
  TIA
  
Kerwin S. Crawford
System Analyst
Toastmaster Inc.
A 
  subsidiary of Salton, Inc.
  
    
    I have a problem with a opnqryf.
     
    I have two files that I am joining and 
    selecting data from them.  These two files are DDM files.  I am 
    then calling a RPGLE program to process the selected information.  My 
    RPG is not finding any records.  I should have several.  I am 
    wondering if I am using the correct file name in the F spec., or what?  
    The following is some excerpt of the code.
     
    ----------------------------------------------------------------------------------------
    CLP  -  CS91001C
      <<snip snip>>
    /* CREATE QUERY SELECTON 
    ---------------------------------------- */   
    
            
    CHGVAR     VAR(&SLTCMD) VALUE('CUSNO2 *EQ ' || 
    &S1CST# +   
    
                         
    || ' *AND QTYSH1 *NE 0 *AND INVDT2 *GE ' +    
    
                         
    || &FROMDTA || ' *AND INVDT2 *LE ' || &TODTA) 
    
                                                                       
    
/* RUN QUERY ---------------------------------------------------- 
    */   
    
            
    OPNQRYF    FILE((*LIBL/SODATAN *FIRST SODATACN) 
    +          
    
                         
    (*LIBL/SOMAST *FIRST SOMASTCB)) 
    +             
    
                         
    FORMAT(&LIB2/CS91001WF1 CS91001WFR) 
    +         
    
                         
    QRYSLT(&SLTCMD) KEYFLD((CUSNO2 *ASCEND) +     
    
                         
    (INVDT2 *ASCEND)) JFLD((SODATAN/ORDNO +       
    
                         
    SOMAST/ORDNO *EQ) (SODATAN/HSTSQ 
    +            
    
                             
    SOMAST/HSTSQ)) MAPFLD((INVNR2 '2/INVNR') 
    +
                         
    (ITNBR1 '1/ITNBR') (HOUSE1 '1/HOUSE') 
    +   
                         
    (CUSPO2 '2/CUSPO') (ORDNO1 '1/ORDNO') 
    +   
                         
    (COQTY1 '1/COQTY') (QTYBO1 '1/QTYBO') 
    +   
                   
          (QTYSH1 '1/QTYSH') (ISLPR1 '1/ISLPR') 
    +   
                         
    (INSAM1 '1/INSAM') (INVDT2 '2/INVDT') 
    +   
                         
    (SHPNO2 '2/SHPNO') (CUSNO2 '2/CUSNO')) 
    +  
                         
    OPNID(CS910011)                           
/* 
    CALL PROGRAM TO PROCESS THE INFORMATION ---------------------- 
    */
            
    CALL       
    PGM(&LIB/CS91001R)                           
 <<snip 
    snip>>                                                                  
    
     
    ----------------------------------------------------------------------------------------
    RPG   -  
    CS91001R                                                             
    
    Fcs91001wf1IF   
    E             
    DISK        
      <<snip snip>>
    c                   
    read      
    cs91001wfr                             
    11    eof  
    
c                   
    if        *in11 = 
    *on                                       
    
      <<snip snip>>
     
    ----------------------------------------------------------------------------------------
    PF  -  CS91001WF1
    A          R 
    CS91001WFR                                                   
    
A            
    INVNR2         6S 
    0       COLHDG('INVOICE' 'REF' 
    'NUMBER')   
    
A            
    ITNBR1        
    15A         COLHDG('ITEM' 
    'NUMBER')            
    
A            
    HOUSE1         
    3A         
    COLHDG('WAREHOUSE')                
    
A            
    CUSPO2        
    22A         COLHDG('PURCHASE' 
    'ORDER' 
    'NUMBER')
A            
    ORDNO1         
    7A         COLHDG('ORDER' 
    'NUMBER')           
    
A            
    COQTY1        10S 
    3       COLHDG('CUSTOMER' 'ORDER' 
    'QTY')   
    
A            
    QTYBO1        10S 
    3       COLHDG('BACKORDERED' 
    'QUANTITY')   
    
A            
    QTYSH1        10S 
    3       COLHDG('QUANTITY' 
    'SHIPPED')       
    
A            
    ISLPR1        15S 
    3       COLHDG('SELLING' 
    'PRICE')          
    
A            
    INSAM1        13S 
    2       COLHDG('NET' 'SALES' 
    'AMOUNT')     
    
A            
    INVDT2         7S 
    0       COLHDG('INVOICE' 
    'DATE')           
    
A            
    SHPNO2         
    4A         COLHDG('SHIP-TO' 
    'NUMBER')         
    
A            
    CUSNO2         8S 
    0       COLHDG('CUSTOMER' 
    'NUMBER')        
----------------------------------------------------------------------------------------
     
    With the time that I have spent trying to 
    figur this out I could have rewote the program not to use the opnqryf 
    comand, but I must know what is wrong.
    
Kerwin S. Crawford
System 
    Analyst
Toastmaster Inc.
A subsidiary of Salton, 
  Inc.