15 pts.
 rpg sql
I am using dynamic sql in an rpgle pgm. This pgm is called from 2 different menu options. When I take the 2nd option, everything works fine. I exit out of that option and take the first option. Everything is still work fine. I exit the first option and go back to the 2nd option and the pgm hangs up when I open the cursor in the sql open statement. I am sure the cursor has been closed. Anyone have any suggestions? Thanks.

Software/Hardware used:
ASKED: June 18, 2008  4:33 PM
UPDATED: April 27, 2010  7:30 AM

Answer Wiki:
Hi, Can you take a look at the open files for the job and see whether the files are still open? Do you have any OVRDBF's in place? Try a RCLRSC between menu options and see whether that makes any difference. Regards, Martin Gilbert. ============================================================ Do not use RCLRSC at all unless you are <b>certain</b> that all active processes are OPM. If you have ILE activation groups in your job (and you quite possibly do if you're executing any number of IBM functions, not to mention your own application code), you can mess things up real quick. Most likely the RPGSQL programs/modules need to be recompiled with appropriate options to close cursors properly. Show the compile options that were used, including SQL options. Suggestions can be given that may be more appropriate. Tom
Last Wiki Answer Submitted:  April 27, 2010  7:30 am  by  Gilly400   23,625 pts.
All Answer Wiki Contributors:  Gilly400   23,625 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

“I am sure the cursor has been closed”.

So was I, with some of my embedded SQL programs! But, I was wrong.

Make sure that there is only one way out of your program, and that way out closes the cursor(s) and sets *INLR = *ON.

RCLRSC will close open files, but does not always have an effect on the SQL cursor, especially if you are running it between options in a menu-based application, because the call level at which the command is run may be higher than the cursor level.

Sloopy

 2,195 pts.