Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

multiple rows fetch problem to host variables

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
swarna bathala

New User


Joined: 27 Apr 2009
Posts: 1
Location: hyderabad

PostPosted: Wed Dec 09, 2009 9:45 pm    Post subject: multiple rows fetch problem to host variables
Reply with quote

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
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Dec 09, 2009 10:24 pm    Post subject:
Reply with quote

Hello,

If there is the possibility of returning more than one row, suggest you use a cursor. . .
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Wed Dec 09, 2009 11:38 pm    Post subject:
Reply with quote

When you get a error sql code you should never depend on any host variables that may be returned.
Back to top
View user's profile Send private message
sachin_star3
Warnings : 1

New User


Joined: 30 Sep 2006
Posts: 78
Location: pune

PostPosted: Thu Dec 10, 2009 12:53 pm    Post subject: Reply to: multiple rows fetch problem to host variables
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6967
Location: porcelain throne

PostPosted: Thu Dec 10, 2009 7:12 pm    Post subject:
Reply with quote

if your db2 vsn supports mult-row fetch, that is also an option where you do not need a cursor.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm
This topic is locked: you cannot edit posts or make replies. SDSF multiple spool datasets extracte... PJAlarcon CLIST & REXX 1 Fri Apr 21, 2017 10:50 pm
No new posts Validating file with multiple header/... mohitsaini DFSORT/ICETOOL 6 Thu Apr 13, 2017 1:53 am
No new posts Strings with double quotes having pro... raja Arumugam All Other Mainframe Topics 11 Thu Mar 30, 2017 10:34 am
No new posts Data replication from multiple Db2 ta... kishpra DB2 9 Mon Mar 27, 2017 9:58 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us