Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 6968
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 Update table without cursor Ron Klop DB2 3 Wed Oct 11, 2017 1:06 pm
No new posts Fetch Previous month & year in MM... girishb2 DFSORT/ICETOOL 3 Thu Sep 21, 2017 9:54 pm
No new posts column with count of rows within dist... ronald wouterson DB2 4 Sun Sep 17, 2017 9:48 pm
No new posts Moving values to a variable of copybo... Vignesh Sid COBOL Programming 6 Wed Sep 06, 2017 1:04 pm
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us