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


  • Subject: Undefined cursor in SQLRPGLE service program
  • From: tomh@xxxxxxxxx
  • Date: Thu, 3 May 2001 14:12:41 -0500


Here's a snippet from my code:

 *******************************************************
 *  RtvChnIDDsc  Retrieve Chain ID Description          
 *               from IDCODE file                      
 *                                                      
 *  Return value:                                      
 *   *on = error, chain id not found                    
 *   *off = no error, chain id was found                
 *******************************************************
p RtvChnIdDsc     b                   export            
d RtvChnIdDsc     pi             1n                    
d  $cono                         3s 0                  
d  $chnid                        2                      
d  $desc                        30                      
                                                       
d                 ds                                    
d $fldlbl                       12    inz('CHNGRP')    
d $fldval                        6                      
                                                           
c                   eval      $fldval = $chnid + '00' + '  '
                                                           
c/Exec Sql                        
c+ DECLARE @@ChainID cursor for  
c+   select iddescrp from idcode  
c+   where ((idcompny = :$cono)  
c+      and (idfldlbl = :$fldlbl)
c+      and (idfldval = :$fldval))
c/End-Exec                        
                                 
 *  Open cursor                  
c/Exec sql                        
c+ open @@ChainID                
c/End-Exec                        
                                 
 *  Fetch first row              
c/exec sql                        
c+ fetch next from @@ChainID      
c+ into :$desc                    
c/end-exec                              
                                       
 *  If any found, read 'em              
c                   if        sqlcod = 0
c                   return    *off      
c                   else                
c                   return    *on      
c                   endif              
c                   close     @@ChainID
p RtvChnIdDsc     e                    

When I compile the (using option 15 from PDM menu), I get the following in the error list:
*RNF7030 30      0         The name or indicator @@CHAINID is not defined.

If I comment out the 'close   @@ChainID', the module compiles fine, but calls to this function don't work right.  Can I do this sort of thing in a service program?

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.