View previous topic :: View next topic |
Author |
Message |
Ramkumarinfo Beginner
Joined: 06 Jun 2007 Posts: 5 Topics: 3
|
Posted: Fri Jun 15, 2007 5:30 am Post subject: Select statement not returning row inserted. |
|
|
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 |
|
 |
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Fri Jun 15, 2007 6:23 am Post subject: |
|
|
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 |
|
 |
blitz2 Beginner

Joined: 23 Jan 2007 Posts: 84 Topics: 14
|
Posted: Mon Jun 18, 2007 1:18 am Post subject: |
|
|
agree with dbz, you need to provide more details. _________________ If our constitution allows us free speech, why are there phone bills? |
|
Back to top |
|
 |
Ramkumarinfo Beginner
Joined: 06 Jun 2007 Posts: 5 Topics: 3
|
Posted: Mon Jun 18, 2007 7:38 am Post subject: |
|
|
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 |
|
 |
nileshpalve Beginner
Joined: 06 Nov 2006 Posts: 10 Topics: 4
|
Posted: Tue Jun 19, 2007 8:51 am Post subject: |
|
|
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 |
|
 |
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Tue Jun 19, 2007 11:06 am Post subject: |
|
|
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 |
|
 |
madhavi_jhoshi Beginner
Joined: 20 Jun 2007 Posts: 2 Topics: 1 Location: Bangalore
|
Posted: Sat Jun 23, 2007 12:04 pm Post subject: |
|
|
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 |
|
 |
|
|