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
 

 

DB2 Cursors

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

New User


Joined: 29 Nov 2008
Posts: 62
Location: mumbai

PostPosted: Tue Jun 15, 2010 3:26 pm    Post subject: DB2 Cursors
Reply with quote

Hi,

I have a question on the declaration of CURSOR in DB2. My existing program uses CURSOR to fetch records from a DB2 table and then my program further filter out records that are 2 days old (by comparing maintenance date which is part of table variable).

Now i want to modify this logic and want that the extarcted records from cursor itself should be 2 days old. So my first question is, if it is feasible to use such a logic using system date variable like 'CURRENT-DATE' etc.
And if it is then what all process/precautions i need to follow to achieve the above objective.

Thanks in advance.
Arun
Back to top
View user's profile Send private message

cvishu

Active User


Joined: 31 Jul 2007
Posts: 136
Location: india

PostPosted: Tue Jun 15, 2010 5:52 pm    Post subject:
Reply with quote

When you use 'CURRENT-DATE' it will be the system date , normally bussiness applications prefer to use their own business dates to avoid issues when processing on business holidays.

Just a friendly tip , get you requiremnts clarified.
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1013
Location: India

PostPosted: Tue Jun 15, 2010 5:57 pm    Post subject:
Reply with quote

Arun,

In DB2, CURRENT DATE gets you the current system date and you can use that in a query.
For example:,
Code:
select current date from sysibm.sysdummy1;


You might need a where clause like
Code:
WHERE you-date-column > CURRENT DATE - 2 DAYS;     


Thank You,
Sushanth
Back to top
View user's profile Send private message
arun nehra

New User


Joined: 29 Nov 2008
Posts: 62
Location: mumbai

PostPosted: Tue Jun 15, 2010 6:51 pm    Post subject:
Reply with quote

Thanks All,
I will do the needful.

Regards
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 Handling multiple cursors in cobol - ... Thirumurgann DB2 5 Thu Sep 15, 2011 8:02 am
No new posts DB2 Select without using cursors in E... dick scherrer CA Products 3 Mon Aug 22, 2011 2:39 pm
No new posts How to Insert multiple Rows into Db2 ... dick scherrer DB2 2 Wed Jul 27, 2011 1:49 pm
No new posts Ques reagrding cursors Amb DB2 2 Fri May 27, 2011 1:08 pm
No new posts What are the impacts of ISOLATION LEV... RedDevil711 DB2 9 Fri Jun 04, 2010 8:49 am


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