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: 6970
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 How to force a select query to abend neo4u DB2 5 Mon Apr 23, 2018 1:36 pm
No new posts SELECT TO MULIPLE OUTFIL speermb DFSORT/ICETOOL 5 Fri Mar 23, 2018 10:44 pm
No new posts Group changes and numbering the groups Auryn DB2 2 Tue Mar 20, 2018 7:12 pm
No new posts How to group and sum the decimal value sakrat DFSORT/ICETOOL 2 Tue Mar 06, 2018 9:13 pm
No new posts Logic to skip Maximum time-stamp and ... vickey_dw DB2 2 Thu Feb 01, 2018 11:15 pm

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