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



On Wed, 2005-08-24 at 13:39, Kevin Elliott wrote:
> All:
> 
> I am writing a quickie program to correct monthly
> sales totals. I need to use SQL to perform the 
> select & sum of the monthly total from a Sales Invoice
> Header & Detail file. When I compile
> the source, I get the error message: Position 9 INTO
> clause missing from embedded statement.

As Peter suggested, you have no host variables indicated to recieve the
return values. As for the rest:

1) No, you do not need to use quotes on the AS clauses.
2) And really, you don't need the AS at all... this can be handy in
other languages where you can access the result set columns by name, but
you can't do that in RPG, and since you will be automatically moving the
return values into program variables, the AS is an unnecessary
complication.

Here is the modified SQL:

> C/EXEC SQL                                                             
> C+ SELECT SUM(ILQTY), SUM(ILQTY * ILNET)
   C+ INTO :sqlqt1, :sqlsl1
> C+ FROM SIH, SIL                                      
> C+ WHERE (SIINVN = ILINVN) and (SICUST = :CUSNBR) and
> (ILPROD = :ITMNBR)
> C+       and (SIINVD BETWEEN 20050701 and 20050731)   
> C/END-EXEC                                            

ITJungle just posted my second articel in a two-part series, you may
find them useful:

Article I - http://www.itjungle.com/fhg/fhg081005-story01.html
Article II - http://www.itjungle.com/fhg/fhg082405-story01.html

HTH,

Joel Cochran
http://www.rpgnext.com


As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.