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



Charles,

Thank you.. This solved this problem ... Now stumbling on the other
(previously not dived into):

p GetFirstrdva    b                                                 
d GetFirstrdva    pi             1n                                 
d  @i_DVASTS                          Like(RDVA.DVASTS    )         
d                                     Const                         
d  @i_DVAN08                          Like(RDVA.DVAN08    )         
d                                     Options(*nopass)              
d                                     Const                         
d  @i_DVAN08WER                       Like(RDVA.DVAN08WER )         
d                                     Options(*nopass)              
d                                     Const                         
d  @i_DVADATIND                       Like(RDVA.DVADATIND )         
d                                     Options(*nopass)              
d                                     Const                         
d AccessOK        s                   Like(GetFirstrdva)            
d                                     inz(*off)                     
C/exec sql                                                          
C+ open RDVACursor                                                  
C+     using :@i_DVASTS, :@i_DVAN08, :@i_DVAN08WER                  
C/end-exec                                                          
C                   EVAL      AccessOK = (SQLSTT = '00000')         
C                   EVAL      @_rdva = SQLSTT                       
C                   IF        AccessOK                        
C/exec sql                                                    
c+ fetch first                                                
c+  from RDVACursor                                           
c+   into :RDVA                                               
c/end-exec                                                    
C                   ENDIF                                     
C                   RETURN    AccessOK                        
p GetFirstrdva    e                                        
   
Now the (pre)compiler has the following complaints:

SQL0314  11    3748  Position 20 Hostvariabele @I_DVASTS not unique.   
SQL0314  11    3748  Position 32 Hostvariabele @I_DVAN08 not unique.   
SQL0314  11    3748  Position 44 Hostvariabele @I_DVAN08WER  not unique.


Now, I may be mistaken (and I probably am) but tell me... How many
@i_DVASTS variables are there defined (and therefore... How which others
does this pre-compiler see?).

Don't tell me that the RPG Pre-compiler has absolutely no knowledge of
global and local variables (there are other procedures present all using
the same parameter names).

Again: thanks for the precious time,

Cor

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx 
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Wilt, Charles
Sent: maandag 13 november 2006 13:47
To: RPG programming on the AS400 / iSeries
Subject: RE: It must be Monday, what have I done now?

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.



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