Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Cursor retrieving same data all the time

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
venkata_naresh

New User


Joined: 16 Feb 2007
Posts: 2
Location: Markapur

PostPosted: Wed Mar 11, 2009 12:45 am    Post subject: Cursor retrieving same data all the time
Reply with quote

Hi, I have declare a DEPOSIT-CURSOR in my program where i will read account number from file and get the sum of deposit balance by fetching and summing up deposit balance from cursor. The problem i am facing is the cursor is retrieving data correctly for the first account from the file. starting from second account number it is returning same rows as of the first account. appreciate help and ideas.
Back to top
View user's profile Send private message

murugan_mf

Active User


Joined: 31 Jan 2008
Posts: 148
Location: Chennai, India

PostPosted: Wed Mar 11, 2009 12:58 am    Post subject: Reply to: Cursor retrieving same data all the time
Reply with quote

My guess is May be you are not reading the file inside fetch cursor loop..

Helpful if you post the portion of your code
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Mar 11, 2009 1:31 am    Post subject:
Reply with quote

Hello and welcome to the forum,

Is the cursor defined for one account number?

Did you close and open the cursor when account number changes?
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Wed Mar 11, 2009 1:35 am    Post subject:
Reply with quote

If there is a host variable in your where clause and it changes then you must close and open the cursor again
Back to top
View user's profile Send private message
rajeshps19

New User


Joined: 14 Feb 2007
Posts: 4
Location: Noida

PostPosted: Wed Mar 11, 2009 2:55 am    Post subject:
Reply with quote

Hi Naresh,

As per my understanding you are reading account-no from file and then getting the related data thru cursor. Since u are using cursor, the account-no host variable should be populated with new values from file before opening the cursor again. You should also close the cursor once u retrieve data for one acct-no. Then again open the cursor for next acct-no. If u don't close the cursor then it will retrieve the same data as previous due to the cursor pointing to the previous record.

Thanks,
Rajesh.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Testing rerad cursor for status with ... John F Dutcher DB2 8 Fri May 19, 2017 9:35 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts DSNACCOX (can it be run on 1 db/ts, t... SRICOBSAS DB2 3 Sat May 06, 2017 12:59 am
No new posts Group Data based on a key Arun Raj DFSORT/ICETOOL 7 Thu Apr 27, 2017 11:29 pm
No new posts unload data from table with lob columns farhad_evan DB2 0 Sat Apr 22, 2017 1:32 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us