|
Patrick, If you are using RPG ILE, change the value of the close SQL cursor (CLOSQLSCR) parm to *ENDMOD. If you are not using ILE then change the parm to *ENDPGM. This worked for me when I was having a similar problem. HTH, Rich Dotson RT3 Consulting Services, Inc. P.O. Box 126 Lorain, OH 44052-0126 Phone: 1-216-556-1710 eMail: rich_dotson@hotmail.com or rich_dotson@centuryinter.net >From: Patrick Fleming <patrickf@real.com.au> >To: "'MIDRANGE-L@midrange.com'" <MIDRANGE-L@midrange.com> >Subject: Problems with ODP in SQL cursor >Date: Mon, 3 Nov 1997 10:49:53 +1100 >Reply-To: MIDRANGE-L@midrange.com > >Hi > >I have a problem which I just discovered, where an open data path is = >being reused by a SELECT clause, even though the SELECT clause is = >different prom the clause that created the ODP. Why did it reuse the = >ODP, and how can I specify that the ODP gets rebuilt each time I open = >the cursor. > >I have written an ILE RPG program on our V3R7 AS/400 that contains a = >PREPARE the cursor, DECLARE , OPEN CURSOR and CLOSE CURSOR. This program = >is called in a loop from another program and is passed a region code. = >The region code is concatenated to a string containing a "SELECT field1, = >field2, field3..... WHERE xxxxxx GROUP BY field1, field2, field3" > >The program runs interactively, reading the file which is overriden into = >QTEMP. The joblog tells me after the PREPARE that the ODP was reused, = >and doesn't rerun the SQL SELECT clause I just built, but reuses the SQL = >from the first invocation. I am setting on LR at the end of the program = >before returning to the previous program to get the next region code. > >My question is, how do I get DB2 not to reuse the old query, but to = >rebuild the query each time I open the cursor (i.e. each time the = >program is invoked from its calling program). I have other programs = >using the PREPARE etc. and they work ok (though they are not called by = >anything). > >Please help=20 > >TIA > >Patrick Fleming >(patrickf@real.com.au) >+--- >| This is the Midrange System Mailing List! >| To submit a new message, send your mail to "MIDRANGE-L@midrange.com". >| To unsubscribe from this list send email to MAJORDOMO@midrange.com >| and specify 'unsubscribe MIDRANGE-L' in the body of your message. >| Questions should be directed to the list owner/operator: david@midrange.com >+--- > ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com +--- | This is the Midrange System Mailing List! | To submit a new message, send your mail to "MIDRANGE-L@midrange.com". | To unsubscribe from this list send email to MAJORDOMO@midrange.com | and specify 'unsubscribe MIDRANGE-L' in the body of your message. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
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.