View previous topic :: View next topic
|
Author |
Message |
swarna bathala
New User
Joined: 27 Apr 2009 Posts: 1 Location: hyderabad
|
|
|
|
Hi,
When i used a select query in a COBOL program to fetch a value in to host variable, if there is a single value corresponding to that select criteria it fetches fine, but when ever there are multiple rows for that select criteria it is showing -811 sql code but also fetching the second qualified row into the host variable.
But when i used the same COBOL code in AIX it is not fetching any rows to the host variable.
Please let me know how mainframe COBOL is handling the code in this situation.
Thanks
Somasekhar Gajjala. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
If there is the possibility of returning more than one row, suggest you use a cursor. . . |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
When you get a error sql code you should never depend on any host variables that may be returned. |
|
Back to top |
|
|
sachin_star3 Warnings : 1 New User
Joined: 30 Sep 2006 Posts: 78 Location: pune
|
|
|
|
Use the cursor,
Whenever you are dealing with more than one row then you should need to use the cursor,
singltone select query will fetch only the one row. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
if your db2 vsn supports mult-row fetch, that is also an option where you do not need a cursor. |
|
Back to top |
|
|
|