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



We have a program that does this (it's an order search program we use
both green screen and through the web). We have the close cursor compile
option set to *ENDACTGRP. Here's how we did it:

- Program is called to open the cursor (we have a parameter to do this)
and return a subset of the results.
- Program is called additional times to get records.
- When the user is done viewing records, it's called again to close the
cursor (another parameter is passed to make is do this).
- If selection criteria is changed, both parameters are passed which
makes it close the open cursor and open a new one based on the selection
criteria passed in.

You also need to make sure that you have an error handling routine in
both programs that ensures that the close cursor statement is run if
anything ends abnormally or the user running it will need to sign off
before it will work again.

Also, I'm pretty sure that the SQL programming books discuss this issue.
It may be worth a look at them before you go much further.

Matt

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Krish Thirumalai
Sent: Wednesday, May 11, 2005 4:45 PM
To: RPG programming on the AS400 / iSeries
Subject: Re: SQL RPG and open cursors

The SQLSTT that we get is 24501 " The identified cursor is not open"

It looks like the cursor is getting closed, but we haven't figured out
why.  Also the "WITH HOLD" statement the IBM site refers to gives a
syntax error

On 5/11/05, rob@xxxxxxxxx <rob@xxxxxxxxx> wrote:
> What error is that?
> 
> Rob Berendt
> --
> Group Dekko Services, LLC
> Dept 01.073
> PO Box 2000
> Dock 108
> 6928N 400E
> Kendallville, IN 46755
> http://www.dekko.com
> 
> Krish Thirumalai <krishnithya@xxxxxxxxx>
> Sent by: rpg400-l-bounces@xxxxxxxxxxxx
> 05/11/2005 02:58 PM
> Please respond to
> RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>
> 
> To
> RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>
> cc
> 
> Subject
> SQL RPG and open cursors
> 
> 
> We are running into an issue with embedded SQL in an RPGLE program
> which is called from a another pgm to retreive one record/row at a
> time.
> 
> The idea is the calling pgm gets the variables that determine which
> cursor to use and passes them to the SQL pgm.  On the first call for
> that set of parms the called pgm will determine which cursor to use,
> open it, and fetch the first row.  On subsequent calls we pass a flag
> that lets the pgm know the variables haven't changed so we just want
> to fetch the next row.  We only want to close the open cursor, run
> through the determination process, and open the new cursor if the
> rules from the calling pgm have changed.
> 
> The problem is we are always getting an error on the second fetch from
> a cursor opened under a previous call.  INLR is not on.
> 
> Does anyone know a way around this or have you done something similar?
> 
> Regards,
> --
> Krish Thirumalai
> 
> --
> 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.
> 
> 


-- 
Krish Thirumalai

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