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