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
 

 

usage of select * in cursor and group variable in fetch

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

New User


Joined: 18 Aug 2008
Posts: 98
Location: India

PostPosted: Wed Jul 15, 2009 7:49 pm    Post subject: usage of select * in cursor and group variable in fetch
Reply with quote

Hello

I am using the following code in my program. Please suggest whether it will work fine. I dont have option to run it in a mainframe so asking here..

cursor decclaration.:

EXEC SQL
DECLARE CRS-MIFIDTRADING CURSOR WITH HOLD FOR
SELECT *
FROM
TGOVMIFIDTRADING
WHERE
INSTRUMENTID = : WS-INSTRUMENTID
END-EXEC.


and fetching it in this way..

EXEC SQL
FETCH CRS-MIFIDTRADING
INTO :DCLTGOVMIFIDTRADING
END-EXEC

DCLTGOVMIFIDTRADING is the dclgen variable. (group variable)

Can I use the select * and the DCLGEN 01 level variable for fetching?

Regards
Rohit
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


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

PostPosted: Wed Jul 15, 2009 8:22 pm    Post subject:
Reply with quote

I don't know, don't have time to access my mainframe,
never used it since it is such a stupid thing to do.

But there is a 'button' at the top of this page: MANUALS.

you probably will find that a DB2 programmers guide or reference manual would have something to say about using * in the SELECT phrase for a CURSOR.
Back to top
View user's profile Send private message
Ketan Varhade

Active User


Joined: 29 Jun 2009
Posts: 197
Location: Mumbai

PostPosted: Thu Jul 16, 2009 11:43 am    Post subject:
Reply with quote

HI Rohit,
I will work fine but its always been advisable to use the column name instead of using select * and also while fetching you should use all the variable name in which you fetching the records.

Regards
Ketan varhade
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 Testing rerad cursor for status with ... John F Dutcher DB2 8 Fri May 19, 2017 9:35 pm
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts find RACF group for access to spooled... jzhardy JCL & VSAM 1 Mon May 08, 2017 11:46 am
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Group Data based on a key Arun Raj DFSORT/ICETOOL 7 Thu Apr 27, 2017 11:29 pm


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