View previous topic :: View next topic
|
Author |
Message |
ap_mainframes
Active User
Joined: 29 Dec 2005 Posts: 181 Location: Canada
|
|
|
|
Hello,
In my program, I have got a cursor. I do some processing based on the record it receive from cursor.
I need to commit ( manually ) in my program. Can some one tell me what all things I need to do with the cursor ? Like, do I need to repositon the cursor etc ?
Thanks for all the help anyone can provide. |
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1248 Location: Richfield, MN, USA
|
|
|
|
If you use the WITH HOLD option of your OPEN CURSOR, it will remain open across COMMITs, otherwise a COMMIT will close it. |
|
Back to top |
|
|
ap_mainframes
Active User
Joined: 29 Dec 2005 Posts: 181 Location: Canada
|
|
|
|
Thanks..Do I need to worry about repositioning of Cursor ? |
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1248 Location: Richfield, MN, USA
|
|
|
|
Once the cursor is closed, you would need to open it again. Your logic would determine whether or not you need to position the cursor at the desired fetched row. |
|
Back to top |
|
|
ap_mainframes
Active User
Joined: 29 Dec 2005 Posts: 181 Location: Canada
|
|
|
|
ok..but I will use WITH HOLD option so that the cursors are open..then I think I dont have to worry about repositioning..Is my assumption correct ? |
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1248 Location: Richfield, MN, USA
|
|
|
|
Yes. |
|
Back to top |
|
|
ap_mainframes
Active User
Joined: 29 Dec 2005 Posts: 181 Location: Canada
|
|
|
|
Thank you Terry for your help.
Just to summarize my conclusions
I'll use WITH HOLD option in my open cursor. With that the cursor will be open even when commiting in the program. Hence, I dont have to reposition the cursor.
Please correct me if I am incorrect any where...
Once again appreciate your help ! |
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1248 Location: Richfield, MN, USA
|
|
|
|
That's about it. For more detailed info see the link at the top of the screen called IBM Manuals. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
And to build confidence, create a very small program that is fed specific values to force different "found sets" for different iterations using the cursor. The only reason for the program is to exercise the question cursor and commit.
Do some commits and some without and put displays in the code to track the results.
When you see it work as you understand, it is a great confidence builder
If there are any surprises, someone will be here. |
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1248 Location: Richfield, MN, USA
|
|
|
|
Nothing beats writing little test programs as Dick suggests to better understand how things work. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
I believe there is a work-culture problem here.
Quote: |
Nothing beats writing little test programs as Dick suggests to better understand how things work |
I fully agree and do it often. But it seems as if most of the posters
not only can not or will not do this -- for what ever reason. |
|
Back to top |
|
|
ap_mainframes
Active User
Joined: 29 Dec 2005 Posts: 181 Location: Canada
|
|
|
|
Alright, it worked for me and the results are fine.
Thks all for all the help. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
You're welcome.
Good to hear it is working - thanks for letting us know
d |
|
Back to top |
|
|
|