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



Chris,

Are you missing the WITH RETURN on the declare cursor?

 C/EXEC SQL                                                    
           
 C+ DECLARE C1 SCROLL CURSOR WITH RETURN FOR SELECT * FROM xxxxxxxxxx
 
 C/END-EXEC                                                    


HTH,
Charles

> -----Original Message-----
> From: Chris Wolcott [mailto:CWolcott@xxxxxxxxxxxxxxxxxxxxxx]
> Sent: Tuesday, June 15, 2004 3:07 PM
> To: rpg400-l@xxxxxxxxxxxx
> Subject: SQL Issues
> Importance: High
> 
> 
>  
> I am trying to write an RPGLE program with embedded SQL.  If 
> I create a
> DS OCCURS() structure, populate it via RPGLE commands and issue a SET
> RESULT SETS ARRAY :name FOR :nbr ROWS command I get a result set.
> However, if I DECLARE CURSOR, OPEN CURSOR and SET RESULT SETS 
> CURSOR, I
> get NOTHING.  (Not even an empty table)  I am testing it via 
> OPSNAV Run
> SQL Scripts.
> 
> Any ideas on what I'm doing wrong?
> 
> Using a DS:  (This gives me 10 rows, with only the first 
> having data in
> it, as expected.)
> 
> D OptList         DS           385    OCCURS(1024)
> D   OptName                     25A               
> D   OptCode                     10A               
> D   OptPrms                    350A               
> 
> C                   CLEAR     *ALL          OptList
> C                   EVAL      OptName = 'Test'         
> C                   EVAL      OptCode = 'Test2'        
> C                   EVAL      OptPrms = 'Test3'        
> C/EXEC SQL                            
> C+ SET RESULT SETS ARRAY :OptList FOR 10 ROWS
> C/END-EXEC 
> 
> Using Cursor:  (I've tried it with/without SCROLL and WITH HOLD, no
> joy.)
> 
> C/EXEC SQL                                                    
>           
> C+ DECLARE C1 SCROLL CURSOR WITH HOLD FOR SELECT * FROM xxxxxxxxxx
> 
> C/END-EXEC                                                    
>           
> C/EXEC SQL                                                    
>           
> C+     OPEN      C1                                           
>           
> C/END-EXEC                                                    
>           
> C/EXEC SQL                                                    
>           
> C+     SET       RESULT SETS CURSOR C1                        
>           
> C/END-EXEC
> 
> 
> --
> 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.
> 

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.