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
 

 

Question regarding Cursor..Plz Help!

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

New User


Joined: 26 Jan 2007
Posts: 37
Location: USA

PostPosted: Tue Jan 19, 2010 2:39 am    Post subject: Question regarding Cursor..Plz Help!
Reply with quote

Is this a valid cursor definition and valid fetch stmt?

EXEC SQL DECLARE C1 CURSOR FOR
SELECT * FROM DSN8710.DEPT
WHERE ADMRDEPT = 'A00';

EXEC SQL OPEN C1;

EXEC SQL FETCH C1 INTO :DEPTVAL; -------DEPTVAL is the group variable having all the host col defined under it, in the tabular order we need.
Back to top
View user's profile Send private message

Craq Giegerich

Senior Member


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

PostPosted: Tue Jan 19, 2010 2:44 am    Post subject:
Reply with quote

You need 2 group variables, one for all the host variables for the cols, and one for null-indicators for all the cols. This type of cursor is not allowed at some sites!
Back to top
View user's profile Send private message
anjani shanker

New User


Joined: 26 Jan 2007
Posts: 37
Location: USA

PostPosted: Tue Jan 19, 2010 2:48 am    Post subject:
Reply with quote

So hwz I am going to keep it...

EXEC SQL FETCH C1 INTO :DEPTVAL:DEPTVALIND;
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue Jan 19, 2010 4:09 am    Post subject:
Reply with quote

Anjani Shanker,

i can tell you do a lot of reading.
there probably is not one manual on the planet that suggests using SELECT *.
Back to top
View user's profile Send private message
anjani shanker

New User


Joined: 26 Jan 2007
Posts: 37
Location: USA

PostPosted: Tue Jan 19, 2010 10:48 pm    Post subject:
Reply with quote

Thanks dbz for the suggestion, I am just trying to bring down the amount of coding to be done for one of my work. Regarding cursor with Select *, i saw one defined in the IBM manual itself and that's why i was curious to know if this really works or not and took it to you guys. Thanks Craq, for your help too!!
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: Tue Jan 19, 2010 11:00 pm    Post subject:
Reply with quote

Hello,

Quote:
I am just trying to bring down the amount of coding to be done for one of my work
Suggest you re-consider the priorities. . .

Firstly, the code must work correctly every time.
Second, the code shouild not waste enormous amounts of resources.
Third, the code must be understandable/maintainable by other than the author.

Meeting these often does not "bring down the amount of code". . . It is better to invest in good code than be concerned about writing the code in the fewest keystrokes. . .
Back to top
View user's profile Send private message
anjani shanker

New User


Joined: 26 Jan 2007
Posts: 37
Location: USA

PostPosted: Wed Jan 20, 2010 9:38 am    Post subject:
Reply with quote

Thanks D.S. for your valuable suggestions, my requirements were somewhat like, using * I considered as an option. Anyways i have it working for me now. Thanks again!!
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 Jan 20, 2010 10:41 am    Post subject: Reply to: Question regarding Cursor..Plz Help!
Reply with quote

You're welcome - good luck icon_smile.gif

d
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 Asynchronous CICS Processing Question moezbud CICS 0 Mon Mar 06, 2017 6:13 pm
No new posts CICS Question RE: Browse, Readnext an... moezbud CICS 7 Sun Mar 05, 2017 5:45 am
No new posts Release of Adabas Cursor mohitsethi All Other Mainframe Topics 1 Mon Feb 06, 2017 8:36 pm
No new posts Updating Cursor row withour using FOR... chandan.inst DB2 15 Tue Nov 08, 2016 11:17 am


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