× 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.



The other embedded sql did not use a prepare either.....its returning 
several rows (10 to be exact) of data.....

The fetch stetement is as follows:

 C/EXEC SQL           
 C+    FETCH SQLCURSOR
 C+    INTO :CUSTNO,  
 C+         :CUSTNAME,
 C+         :SALES,   
 C+         :COST,    
 C+         :MARGIN,  
 C+         :PCT      
 C/END-EXEC           

Then I execute the following:
 C                   MOVE      CUSTNO        DCUSTNO  
 C                   MOVE      CUSTNAME      DCUSTNAME
 C                   MOVE      SALES         DSALES   
 C                   MOVE      COST          DCOST    
 C                   MOVE      MARGIN        DMARGIN  
 C                   MOVE      PCT           DPCT     
 C                   ADD       1             RRN      
 C                   WRITE     SPECSFL                
 C                   ENDDO                            
 C/EXEC SQL                                           
 C+ CLOSE SQLCURSOR                                   
 C/END-EXEC                                           
 C                   EVAL      *IN51 = *ON            

On Tue, 26 Jul 2005 23:06:16 +0200, Carel Teijgeler wrote
> Douglas,
> 
> No PREPARE?
> And in what do you FETCH?
> 
> Besides, you should drink more coffee.
> 
> Regards,
> Carel Teijgeler
> 
> *********** REPLY SEPARATOR  ***********
> 
> On 26-7-05 at 13:52 Douglas W. Palme wrote:
> 
> >I am trying desperately to get this embedded sql down and thought I had
> >it 
> >after the last go around, unfortunately I must be 1. dumber than I
> >thought, 
> >2. losing my mind or 3. had too much gaterade today.  In any event, I am 
> >using the following code to extract the records from the logical file:
> >
> >C     BLDSQL        BEGSR                                        
> >C/EXEC SQL                                                       
> >C+    DECLARE SQLCURSOR CURSOR                                   
> >C+    FOR SELECT                                                 
> >C+    ILNSOLDTO,                                                 
> >C+    ICMNAME,                                                   
> >C+    SUM(ILNEPRICE),                                            
> >C+    SUM(ILNEUAVCST),                                           
> >C+    SUM(ILNEPRICE) - SUM(ILNEUAVCST) AS MARGIN,                
> >C+    (SUM(ILNEPRICE) - SUM(ILNEUAVCST)) / SUM(ILNEPRICE) AS MPCT
> >C+    FROM SPECGASLF                                             
> >C+    WHERE                            
> >C+          ILNINVDATE > :STARTDATE AND
> >C+          ILNINVDATE <= :ENDDATE     
> >C+    GROUP BY                         
> >C+             ILNSOLDTO,              
> >C+             ICMNAME                 
> >C+    ORDER BY                         
> >C+             MPCT DESC               
> >C/END-EXEC                             
> >
> >I am then opening the cursor with the very next sql statement:
> >
> >C/EXEC SQL          
> >C+    OPEN SQLCURSOR
> >C/END-EXEC          
> >
> >Then I set the indicators for my subfile:
> >
> >C                   EVAL      *IN52 = *ON 
> >C                   WRITE     SPECCTL     
> >C                   EVAL      *IN52 = *OFF
> >C                   DOU       RRN = 10    
> >
> >I am then using a fetch statement to extract the record, move them into 
> >variables and then write it to the subfile, however when I was in debug
> >mode 
> >and viewed the variables at it was moving them into the subfiles fields 
it 
> >wasn't passing any data.....so of course it errors on a blank record.
> >
> >Ideas, suggestions? or just tell me to get lost......
> >
> >
> >If you bought, it was hauled by a truck - somewhere, sometime.
> >
> >-- 
> >This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
> >To post a message email: RPG400-L@xxxxxxxxxxxx
> >To subscribe, unsubscribe, or change list options,
> >visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
> >or email: RPG400-L-request@xxxxxxxxxxxx
> >Before posting, please take a moment to review the archives
> >at http://archive.midrange.com/rpg400-l.
> 
> -- 
> This is the RPG programming on the AS400 / iSeries (RPG400-L)
>  mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To 
> subscribe, unsubscribe, or change list options, visit: 
> http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-
> L-request@xxxxxxxxxxxx Before posting, please take a moment to 
> review the archives at http://archive.midrange.com/rpg400-l.


If you bought, it was hauled by a truck - somewhere, sometime.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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.