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
 

 

Cursors-- Last record

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
View previous topic :: :: View next topic  
Author Message
prabhucs01
Warnings : 1

New User


Joined: 07 Mar 2005
Posts: 43

PostPosted: Sat Sep 05, 2009 7:17 pm    Post subject: Cursors-- Last record
Reply with quote

If i am using cursor in my Cobol-DB2 program and once the last record is received using the cursor, is there any SQLCODE to identify that last record has been reached .

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

dbzTHEdinosauer

Global Moderator


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

PostPosted: Sat Sep 05, 2009 7:27 pm    Post subject:
Reply with quote

well, since there are no records associated with DB2 tables, you question makes no sense.

So, suggesting that you RT FM, V7 DB2 Reference and V7 Appl Pgm Guide and take a look at sqlcode +100.

Even if you are on version 8 or 9, the vsn 7 explanation is no different.
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Sat Sep 05, 2009 7:28 pm    Post subject:
Reply with quote

Not until you get the +100 when trying to FETCH the row after the last one. Does it make that much difference being able to detect the last row?
Back to top
View user's profile Send private message
prabhucs01
Warnings : 1

New User


Joined: 07 Mar 2005
Posts: 43

PostPosted: Sat Sep 05, 2009 7:31 pm    Post subject:
Reply with quote

it was an interview question.,,i did reply with +100 sqlcode the same thing u have mentioned..they were asking about alternate ways of identifying it.
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Sat Sep 05, 2009 7:38 pm    Post subject:
Reply with quote

Interview questions (and your answers) should be posted in the Interview Questions forum. Please read posting guidelines.
Back to top
View user's profile Send private message
Ketan Varhade

Active User


Joined: 29 Jun 2009
Posts: 197
Location: Mumbai

PostPosted: Sun Sep 06, 2009 2:43 am    Post subject:
Reply with quote

When you are asking for the SQL code then +100 is the code for checking for the last row/rowset fetched.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Sun Sep 06, 2009 2:07 pm    Post subject:
Reply with quote

Sorry my links were bad to v7 db2 ref and appl prg guide.
they are accessable via the MANUALs link at the top of the page icon_redface.gif
Back to top
View user's profile Send private message
ajeshrn

New User


Joined: 25 Mar 2009
Posts: 78
Location: India

PostPosted: Mon Sep 07, 2009 2:05 pm    Post subject: Cursors-- Last record
Reply with quote

Hi prabhucs01,

The Open cursor will only return SQLCODE of 0 even when there are no records satisfying your condition.In order to check this logically in the program, you have to do a fetch.FETCH statement will return the SQLCODE +100, when no rows are found.
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 -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts Sort Large record length cmsmoon DFSORT/ICETOOL 14 Tue Apr 11, 2017 5:49 pm
No new posts Format record to remove Leading zeroes Learncoholic DFSORT/ICETOOL 14 Wed Apr 05, 2017 2:43 pm
No new posts Record Not found in AlX but record re... mukun264 COBOL Programming 7 Fri Mar 24, 2017 9:28 am


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