View previous topic :: View next topic
|
Author |
Message |
rinitha
New User
Joined: 22 Aug 2009 Posts: 4 Location: Chennai
|
|
|
|
Hi,
I am trying to fetch a column from a table using a cursor. But the query returns SQL -100 for the first time it fetches. When the program starts processing the next record, and inputs the next record's data into the WHERE clause, the data for the previous record gets fetched.
So i wrote OPEN,FETCH, CLOSE CURSOR steps twice in the program as shown
1) OPEN CURSOR
2) FETCH CURSOR
3) CLOSE CURSOR
4) OPEN CURSOR
5) FETCH CURSOR
6) CLOSE CURSOR
The same input is not giving output in step2 but gives output in step 5. Closing and opening the cursor makes corrects the issue, but i am not sure how this happens. Can somebody help me on this |
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1249 Location: Richfield, MN, USA
|
|
|
|
No one can help given the information you've provided. We need to see a dump of the fetched row using SPUFI or whatever and all of your code relevant to the table including the DCLGEN, the cursor declaration, and all of your SQL for the OPEN and FETCH. Display the host variables immediately before each FETCH and all SQLCODEs after any SQL. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello and welceom to the forum,
What is the sqlcode after the open?
Please include this when posting the other requested info. . . |
|
Back to top |
|
|
|