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



Cor,

You need the prepare before the declare.

<procedure A>
c/exec sql                                       
c+ prepare RHLCSelect                            
c+    from :RHLC_Select                          
c/end-exec                                       

C+ declare RHLCCursor scroll cursor              
C+     for RHLCSelect                            
c/end-exec                                       

<procedure B>
C/exec sql                                                     
C+ open RHLCCursor                                             
C+     using :@i_HLCN08WNR                                     
C/end-exec                                                     


Also, make sure that Procedure B appears after Procedure A in the
source.  The SQL pre-compiler cares about the physical order of
statements in the source, _NOT_ the order in which the RPG program will
eventually run them.  In other words, given the contents of Procedure A
and Procedure B above, Procedure A must come before Procedure B in your
source file.  If your source file has Procedure B followed by Procedure
A you will get an error even if the RPG Program calls Procedure A before
calling Procedure B.

HTH,


Charles Wilt
--
iSeries Systems Administrator / Developer
Mitsubishi Electric Automotive America
ph: 513-573-4343
fax: 513-398-1121
  

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx 
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Takken, Cor
Sent: Monday, November 13, 2006 7:14 AM
To: RPG programming on the AS400 / iSeries
Subject: It must be Monday, what have I done now?

I am still trying to get SQL experience, and by way of a test I have
coded the following:

<procedure A>
C+ declare RHLCCursor scroll cursor              
C+     for RHLCSelect                            
c/end-exec                                       
c/exec sql                                       
c+ prepare RHLCSelect                            
c+    from :RHLC_Select                          
c/end-exec                                       

<procedure B>
C/exec sql                                                     
C+ open RHLCCursor                                             
C+     using :@i_HLCN08WNR                                     
C/end-exec                                                     

Now the compiler doesn't like this, it returns this error:
SQL0504  35    3542  Position 14 Cursor RHLCCURSOR is not declared.

(I have translated the error from dutch, so it might not match the
english description 1:1).

Remains the question: what have I missed here? I have declared the
cursor in procedure A and use it in procedure B. Is it so that because
they are procedures that the scope of the cursors has been limitted to
the defining procedure? I would like to keep the code in 
procedures (and
separate).

Any thoughts are welcome. 


Thanks in advance for your precious time,


Cor Takken


This e-mail and any attachment is for authorised use by the 
intended recipient(s) only. It may contain proprietary 
material, confidential information and/or be subject to legal 
privilege. It should not be copied, disclosed to, retained or 
used by, any other party. If you are not an intended 
recipient then please promptly delete this e-mail and any 
attachment and all copies and inform the sender. Thank you.
-- 
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 ...

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.