× 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: FW: Undefined cursor in SQLRPGLE service program
  • From: "John Taylor" <john.taylor@xxxxxxxxxxxxxxx>
  • Date: Thu, 3 May 2001 21:06:11 -0600
  • Importance: Normal


Oh and by the way, even if your close was coded correctly, it never would
have executed because you're returning to the calling procedure within your
conditional test of SQLCOD.


-----Original Message-----
From: John Taylor [mailto:john.taylor@telusplanet.net]
Sent: Thursday, May 03, 2001 8:58 PM
To: RPG400-L@midrange.com
Subject: RE: Undefined cursor in SQLRPGLE service program



Your code is opening a cursor - which is correct -- and then trying to close
a file -- which is not. Change the 'close @@ChainID' to the following:

Exec Sql
    close @@ChainID
End-Exec


John Taylor
Canada

-----Original Message-----
From: owner-rpg400-l@midrange.com [mailto:owner-rpg400-l@midrange.com]On
Behalf Of tomh@simas.com
Sent: Thursday, May 03, 2001 1:13 PM
To: rpg400-l@midrange.com
Subject: Undefined cursor in SQLRPGLE service program



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?

+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.