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
 
How to increament date

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

New User


Joined: 14 Sep 2005
Posts: 54
Location: Chennai

PostPosted: Thu Aug 06, 2009 5:46 pm    Post subject: How to increament date
Reply with quote

Hi
In my database i have a date field and i want to add 10 or 20 days to it.
how can i get this in COBOL or SQL?

Ex: WS-DATE = 2009-01-31(YYYY-MM-DD format)
WS-VAR = 10
and i want to add 10 days to
WS-DATE field to get WS-FINAL-DATE = 2009-02-10
Back to top
View user's profile Send private message

ashimer

Active Member


Joined: 13 Feb 2004
Posts: 551
Location: Bangalore

PostPosted: Thu Aug 06, 2009 6:00 pm    Post subject:
Reply with quote

Use DATE(:WS-DATE) + 10 DAYS in your update ...
Back to top
View user's profile Send private message
Ketan Varhade

Active User


Joined: 29 Jun 2009
Posts: 197
Location: Mumbai

PostPosted: Fri Aug 07, 2009 8:49 am    Post subject:
Reply with quote

Hi ,

Code:

SELECT  CURRENT TIMESTAMP                 
       ,WS-DATE - :WS-NUM  DAYS         
       ,WS-DATE + :WS-NUM-2 DAYS       
     
  INTO :WS-TSMP-X                         
      ,:WS-CUTOFF                     
      ,:WS-CUTOFF-DTE-2                   
               
  FROM  TABLE NAME
 WHERE  COL1 =  CURRENT DATE
                                 



May be this can help you
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Aug 07, 2009 8:56 am    Post subject:
Reply with quote

Hi Ketan,
Please read what OP wants.

He doesnt want to update only records with todays date..
Also what is COL1 in your query?
Back to top
View user's profile Send private message
Ketan Varhade

Active User


Joined: 29 Jun 2009
Posts: 197
Location: Mumbai

PostPosted: Fri Aug 07, 2009 9:03 am    Post subject:
Reply with quote

Hi Sambhaji,
Correct me if I am wrong ,
In the above query I think he will able to add 10 or 20 day to the variable or the column he want to and COL1 is just a sample column name if there is some criteria of doing the operation. Thats just the sample one

Ketan
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Aug 07, 2009 9:11 am    Post subject:
Reply with quote

Hello,

Quote:
In the above query I think he will able to add 10 or 20 day to the variable or the column he want to
How would the posted query know about 10 or 20?

Please be much more careful when posting suggestions/solutions. Incomplete/incorrect info only makes things harder for the person who asked the question.
Back to top
View user's profile Send private message
Ketan Varhade

Active User


Joined: 29 Jun 2009
Posts: 197
Location: Mumbai

PostPosted: Fri Aug 07, 2009 9:15 am    Post subject:
Reply with quote

Sorry Dick,
But what I understood from the question I tried answer to that I understood from the post. Please can some one make me understand what the requirement is basically .
I will take care in the coming future
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Aug 07, 2009 9:32 am    Post subject:
Reply with quote

Hello,

Quote:
Please can some one make me understand what the requirement is basically .

The post from Ashimer provides the answer to the question asked by Sashi. How to add a number of days to some date. . .
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 Compare yesterday's date to the one o... migusd SYNCSORT 11 Fri Sep 22, 2017 11:35 pm
No new posts Validate the Date girishb2 DFSORT/ICETOOL 9 Tue Sep 19, 2017 1:12 am
No new posts Julian Date to CICS ABSTTIME blayek CICS 3 Wed Aug 30, 2017 11:15 pm
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm

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