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
 

 

Problem with Defining Cursor

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
rsm_deepak

New User


Joined: 06 Apr 2005
Posts: 31
Location: visakhapatnam

PostPosted: Wed Jul 19, 2006 6:18 pm    Post subject: Problem with Defining Cursor
Reply with quote

If the table consists of more fields can we give

EXEC SQL
DECLARE cursor-name CURSOR FOR
SELECT *
FROM table-name
WHERE search-condition
END-EXEC.
Back to top
View user's profile Send private message

cmbb

New User


Joined: 01 Feb 2006
Posts: 4

PostPosted: Wed Jul 19, 2006 7:29 pm    Post subject:
Reply with quote

You can use it. When you fetch this cursor, you must read into the level 01 of the copy with the host variable.
This solution has some problems like, when you change the table, adding or removing fields, you must change the copy and recompile the program.
Back to top
View user's profile Send private message
twissi

Active User


Joined: 01 Aug 2005
Posts: 105
Location: Somerset, NJ

PostPosted: Thu Jul 20, 2006 11:27 am    Post subject: Re: Problem with Defining Cursor
Reply with quote

Quote:
If the table consists of more fields can we give


What do you mean by this? Tables use to have many fields !!

Or did you mean, if the SELECT query returns more rows (than one), can the CURSOR be used?

Yes you can, and that's what CURSORs are meant for! And your program should have a loop to process/handle all rows returned by the CURSOR.


Cheers, Twissi.
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 -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Getting -504 Cursor Name GTT-ARTS-CUR... Robin Sulsona DB2 2 Fri Mar 17, 2017 1:43 am
No new posts Problem reading GTF trace output danik56 ABENDS & Debugging 7 Thu Mar 16, 2017 1:02 pm
No new posts ROUNDED Problem with COMPUTE statement shalem COBOL Programming 11 Thu Feb 09, 2017 8:16 pm
No new posts Release of Adabas Cursor mohitsethi All Other Mainframe Topics 1 Mon Feb 06, 2017 8:36 pm
No new posts SYMNAMES problem jacobdng DFSORT/ICETOOL 7 Thu Dec 22, 2016 7:47 am


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