MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Select statement not returning row inserted.

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
Ramkumarinfo
Beginner


Joined: 06 Jun 2007
Posts: 5
Topics: 3

PostPosted: Fri Jun 15, 2007 5:30 am    Post subject: Select statement not returning row inserted. Reply with quote

Hi,

I have a main program that calls two sub-routine one of which
inserts row in the table. In the second sub-routine based on some
conditions the row is fetched and updated. but, in the
second sub-routine the select statement fails. The row is indeed inserted
in the table successfully but somehow the select statement in second
subroutine is not able to fetch it. The database is DB2 and modules are
in Cobol II.

Can anybody explain what is happening and ho to fix the problem?

Thanks in advance,
Ram
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Fri Jun 15, 2007 6:23 am    Post subject: Reply with quote

I assume you have three modules, 1 main and 2 that are CALLed, one after the other. (dynamic or static CALLs/Linking?)

1st CALLed module inserts a row. SQLCODE for INSERT is 000 ?
2nd CALLed module, when conditions warrant,
attempts a SELECT FOR UPDATE and receives an SQLCODE = to what?

can't start to explain the problem until I know what SQLCODEs you received on the two SQLs:
the INSERT.........sub-module 1
and the SELECT FOR UPDATE........sub-module 2
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
blitz2
Beginner


Joined: 23 Jan 2007
Posts: 84
Topics: 14

PostPosted: Mon Jun 18, 2007 1:18 am    Post subject: Reply with quote

agree with dbz, you need to provide more details.
_________________
If our constitution allows us free speech, why are there phone bills?
Back to top
View user's profile Send private message
Ramkumarinfo
Beginner


Joined: 06 Jun 2007
Posts: 5
Topics: 3

PostPosted: Mon Jun 18, 2007 7:38 am    Post subject: Reply with quote

Hi,

The insert statement returned sqlcode = 0 and select statement returned
sqlcode = 100. The assumption by Dick is correct. The insertion was succesfull could further be confirmed by SQL. Another strange thing is by adding trace statements if we flow thru the sub-routine the updation is succesfull and once the trace is commented it fails again.
Bafling.

Thanks
Ram
Back to top
View user's profile Send private message
nileshpalve
Beginner


Joined: 06 Nov 2006
Posts: 10
Topics: 4

PostPosted: Tue Jun 19, 2007 8:51 am    Post subject: Reply with quote

dbzTHEdinosauer,

Could this be because the commit is not done yet? Or Selects done subsequent to a insert can pull data from buffer (where they remain until committed)?

Regards
Nilesh
Back to top
View user's profile Send private message Send e-mail
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Tue Jun 19, 2007 11:06 am    Post subject: Reply with quote

nileshpalve,
how about your host fields for the WHERE clause in the 2nd subroutine are not populated?

what are the trace statements? is this in a debugger, or are you using IBM's debug or are these display statements?

is this CICS or batch?

what you are saying is that it does not work unless you have 'trace code'. Need to have more info about that....
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
madhavi_jhoshi
Beginner


Joined: 20 Jun 2007
Posts: 2
Topics: 1
Location: Bangalore

PostPosted: Sat Jun 23, 2007 12:04 pm    Post subject: Reply with quote

Hi,
I think when u call the submodule I, after inserting are u doing COMMIT explicitly? If not, add the COMMIT stmt, and check whether it will work fine...



Madhavi
Bangalore, India
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group