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



Need more info.

Have you run this in debug?  if so what where the SQLCOD & SQLSTT values after 
each SQL operation?  It could be that the execution has failed which is causing 
your problem.

Using SQL cursors can have a "domino" effect...

if the DECLARE fails then all other SQL operations on that cursor is pointless,
"" ""  OPEN     ""    ""   ""  ""   ""   ""        ""  ""  ""     "" ""

if the FETCH fails then you'll get bad results (i.e. host variable still 
contains data from previous fetch,etc...)

As far as the code you posted I don't see anything wrong from a cursory glance. 
 Most likely it is a scenario similar to what I listed above.  Run time errors 
don'tcha love 'em??

Thanks,
Tommy Holden


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of Douglas W. Palme
Sent: Wednesday, July 13, 2005 2:30 PM
To: RPG Group
Subject: embedded SQL not outputting to report


I have begun this whole ordeal in hopes of getting down the issue of 
embedding sql statements in my rpg code, I think in the long run it will 
make life much easier.

However, I have not been able to figure out what I am doing wrong with the 
following code, it is supposed to extract the soldto number (cust no) and 
print it in the report.  The field in the externally described report is 
prtcustno....if anyone would be so helpful as to point out what I am doing 
wrong I would greatly appreciate it.

 C     *USA          MOVE      '06/01/2005'  SDATE
 C     *USA          MOVE      '06/30/2005'  EDATE
 C/EXEC SQL                                       
 C+ DECLARE CUSTCURSOR CURSOR                     
 C+ FOR SELECT ILNSOLDTO                          
 C+ FROM INVMARGIN                                
 C+ WHERE ILNINVDATE >= :SDATE AND                
 C+ ILNINVDATE <= :EDATE                          
 C/END-EXEC                                       
 C                   WRITE     HEADINGS           
 C/EXEC SQL                                       
 C+                  OPEN      CUSTCURSOR         
C+                  OPEN      CUSTCURSOR 
C/END-EXEC                               
C/EXEC SQL                               
C+ FETCH NEXT                            
C+ FROM CUSTCURSOR                       
C+ INTO :PRTCUSTNO                       
C+                                       
C/END-EXEC                               
C                   WRITE     DETAILLINE 
C/EXEC SQL                               
C+ CLOSE CUSTCURSOR                      
C/END-EXEC                               
C                   EVAL      *INLR = *ON
C                   RETURN               

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


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.