IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

DB2 Cursors


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
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
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
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: 1020
Location: India

PostPosted: Tue Jun 15, 2010 5:57 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Positioned Deletes/Updates using curs... DB2 3
No new posts Any limit on usage of cursors ? DB2 1
No new posts Is there drawbacks in using DB2 rowse... DB2 11
No new posts Handling multiple cursors in cobol - ... DB2 5
No new posts DB2 Select without using cursors in E... CA Products 3
Search our Forums:

Back to Top