If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > problem with simple select query

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-25-09, 01:14
ranjini99 ranjini99 is offline
Registered User
 
Join Date: May 2009
Posts: 1
Lightbulb problem with simple select query

Hi,
In my cobol-ims-db2 application program, I have a simple SELECT query. First value from input is moved to the keys in the query section. I'm getting the proper output. (SQLCODE =0).
After reading the second record from the file, key is moved perfectly. (I found out by giving display statements before the call). But I'm getting +100 row not found error. But actually I've the same row in the table.

This problem happens if WHENEVER I have any row in the second row.

I ran the program with single row in the input file. My program RAN FINE WITHOUT ANY ABEND. I tried to expedite the program. But no use.

Any suggestions??

Thanks,
Ranjini.S
Reply With Quote
  #2 (permalink)  
Old 05-25-09, 02:30
dr_te_z dr_te_z is offline
Registered User
 
Join Date: Jan 2009
Location: Zoetermeer, Holland
Posts: 555
Please post your cursor defintion and the sections in which you OPEN/FETCH/CLOSE the cursor.
Reply With Quote
  #3 (permalink)  
Old 05-25-09, 02:39
Peter.Vanroose Peter.Vanroose is offline
Registered User
 
Join Date: Sep 2004
Location: Belgium
Posts: 1,079
To obtain values from the same row of your cursor, after the first fetch, don't FETCH a second time since that would (try to) get the second row which doesn't exist.
__________________
--_Peter Vanroose,
__IBM Certified Database Administrator, DB2 9 for z/OS
__IBM Certified Application Developer
__ABIS Training and Consulting
__http://www.abis.be/
Reply With Quote
  #4 (permalink)  
Old 05-25-09, 07:03
umayer umayer is offline
Registered User
 
Join Date: Dec 2005
Posts: 273
Ranjini, did I understand your problem correctly:

You have a file containing some keys.
You read the first record from the file and SELECT INTO data using the key in the WHERE clause which runs fine.
Then you read the second key from the file, again do the SELECT INTO using the new key and that select fails with SQLCODE +100 ?

You DISPLAYed the key to check, whether it was the correct one ?
The program runs fine if there is only one record in your file.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On