IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Getting sqlcode 100 even if the pgm getting correct value


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
paul_007

New User


Joined: 03 Aug 2006
Posts: 33
Location: earth

PostPosted: Wed Mar 07, 2007 11:26 am
Reply with quote

i have coded a cobol db2 pgm in whih i am acessing a table and getting one value frm thr

but i am getting sqlcode of 100 even though the program is getting correct value frm the table , i shud get get sqlcode 0 but getting 100


pls help
Back to top
View user's profile Send private message
vicky10001
Warnings : 1

Active User


Joined: 13 Jul 2005
Posts: 136

PostPosted: Wed Mar 07, 2007 11:57 am
Reply with quote

Please find the below reasons

Explanation: One of the following conditions occurred:

o No row met the search conditions specified in an UPDATE or DELETE
statement.

o The result of a SELECT INTO statement was an empty table.

o The result of the subselect of an INSERT statement is empty.

o A FETCH statement was executed when the cursor was positioned after
the last row of the result table.
Back to top
View user's profile Send private message
raak

Active User


Joined: 23 May 2006
Posts: 166
Location: chennai

PostPosted: Wed Mar 07, 2007 11:59 am
Reply with quote

How do u know that the program is getting correct value from table?

In the program, what r u doing if u get an sql code of 100?

As far as i know, u l get an sql code of 100 if there is no data in the table for the executed query..

provide some more deatils about ur problem
Back to top
View user's profile Send private message
paul_007

New User


Joined: 03 Aug 2006
Posts: 33
Location: earth

PostPosted: Wed Mar 07, 2007 12:00 pm
Reply with quote

Quote:
Please find the below reasons

Explanation: One of the following conditions occurred:

o No row met the search conditions specified in an UPDATE or DELETE
statement.

o The result of a SELECT INTO statement was an empty table.

o The result of the subselect of an INSERT statement is empty.

o A FETCH statement was executed when the cursor was positioned after
the last row of the result table.


thnx 4 help but table is not empty and data is thr and i am not using any cursors, i'm using just a simple select query with no updates,inserts or delete

and i am getting correct value also but only thing is dat sql code is 100 instead of 0
Back to top
View user's profile Send private message
paul_007

New User


Joined: 03 Aug 2006
Posts: 33
Location: earth

PostPosted: Wed Mar 07, 2007 12:04 pm
Reply with quote

Quote:
How do u know that the program is getting correct value from table?

In the program, what r u doing if u get an sql code of 100?

As far as i know, u l get an sql code of 100 if there is no data in the table for the executed query..

provide some more deatils about ur problem


i manually went into the table to see the correct value

in my pgm if sqlcode is not 0 i am writing that record in file2 else writing in file1 ..... the record is written in file1 ...i dont know y i am getting 100
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Wed Mar 07, 2007 12:33 pm
Reply with quote

Hi There,

Would u please paste ur code
Back to top
View user's profile Send private message
raak

Active User


Joined: 23 May 2006
Posts: 166
Location: chennai

PostPosted: Wed Mar 07, 2007 12:54 pm
Reply with quote

u said

'' IF SQL CODE NOT= 0,
WRITE FILE-2
ELSE
WRITE FILE-1"

so if the sql code is 0, it l write in file 1. and u r getting that!!!

how do u come to the conclusion that u r getting sql code 0f 100.

can u post ur query here?
Back to top
View user's profile Send private message
paul_007

New User


Joined: 03 Aug 2006
Posts: 33
Location: earth

PostPosted: Wed Mar 07, 2007 3:30 pm
Reply with quote

Quote:
u said

'' IF SQL CODE NOT= 0,
WRITE FILE-2
ELSE
WRITE FILE-1"

so if the sql code is 0, it l write in file 1. and u r getting that!!!

how do u come to the conclusion that u r getting sql code 0f 100.

can u post ur query here?


yrs u r correct i am getting wat i want but when i display sql code it is 100
Back to top
View user's profile Send private message
raak

Active User


Joined: 23 May 2006
Posts: 166
Location: chennai

PostPosted: Wed Mar 07, 2007 3:50 pm
Reply with quote

can u please post the code here?????? icon_confused.gif
Back to top
View user's profile Send private message
vini_srcna

Active User


Joined: 26 May 2005
Posts: 178
Location: Copenhagen, Denmark

PostPosted: Wed Mar 07, 2007 5:19 pm
Reply with quote

I think you have not put the display statement appropriately. If it is in file1 then sqlcode should be 0. It went to file1 since sqlcode was 0. Now it cannot be hundred. Make sure you are displaying the SQLCODE at the right place. No way DB2 principles can go wrong all of a sudden -icon_smile.gif
Most of the time it would be our mistakes. Please look into the code carefully.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
No new posts SQLCODE = -122 while using the scalar... DB2 4
No new posts SQLCODE = -16002 when using XMLEXISTS DB2 1
No new posts Is SQLCODE -811 possible while fetchi... DB2 1
No new posts SQLCODE=-204 SQLSTATE=42704 DB2 4
Search our Forums:

Back to Top