MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Date Addition

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
coolguy
Beginner


Joined: 01 Dec 2004
Posts: 82
Topics: 28

PostPosted: Thu Jul 26, 2007 4:39 am    Post subject: Date Addition Reply with quote

Hi Friends

I want to calculate some Date funcion


1) I am reading the Date from the file and i and doing some calulations and add 1 day to the date and do the same calution , i want to do same options upto the current date , how to do add days in DB2 could you pleas help me in that

Thanks
Cool
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12380
Topics: 75
Location: San Jose

PostPosted: Thu Jul 26, 2007 6:38 am    Post subject: Reply with quote

coolguy,

Try this

Code:

SELECT DATE(CURRENT DATE + 1 DAYS)
         FROM
         SYSIBM.SYSDUMMY1
         ;
 



Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
coolguy
Beginner


Joined: 01 Dec 2004
Posts: 82
Topics: 28

PostPosted: Thu Jul 26, 2007 6:47 am    Post subject: Reply with quote

Thanks Kolusu But i want to use date which i am reading from the file, not current date please help in this

Cool
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12380
Topics: 75
Location: San Jose

PostPosted: Thu Jul 26, 2007 6:58 am    Post subject: Reply with quote

coolguy,

try this

Code:

ws-file-date pic x(10).
SELECT DATE(:ws-file-date) + 1 DAYS
         FROM
         SYSIBM.SYSDUMMY1
         ;
 


Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
CraigG
Intermediate


Joined: 02 May 2007
Posts: 202
Topics: 0
Location: Viginia, USA

PostPosted: Thu Jul 26, 2007 7:01 am    Post subject: Reply with quote

DB2 has a full set of date functions -- look in the sql reference manual.
Back to top
View user's profile Send private message
coolguy
Beginner


Joined: 01 Dec 2004
Posts: 82
Topics: 28

PostPosted: Fri Jul 27, 2007 1:37 am    Post subject: Reply with quote

Hi Kolusu

Thanks a lot for the kindly help but i am facing the other problem

I am using the code
Code:

ws-file-date pic x(10).
ws-fromdate Pic x(10)

SELECT DATE((:WS-FILEDATE) - 1 DAYS)   
      INTO :WS-FROMDATE                 
      FROM SYSIBM.SYSDUMMY1             
But i am getting the Error while binding
as follows

DSNX200I  - BIND SQL ERROR                                   
           USING TRP001 AUTHORITY                             
           PLAN=HISTLOD1                                     
           DBRM=HISTLOAD                                     
           STATEMENT=923                                     
           SQLCODE=-171                                       
           SQLSTATE=42815                                     
           TOKENS=2 -                                         
           CSECT NAME=DSNXOBFA                               
           RDS CODE=30                                       
DSNT201I  -  BIND FOR PLAN HISTLOD1 NOT SUCCESSFUL     

i have checked for the sql code -171
(ie THE DATA TYPE, LENGTH, OR VALUE OF ARGUMENT nn OF function-name IS INVALID)

Could you please guide me to slove this issue

Thanks
Cool
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12380
Topics: 75
Location: San Jose

PostPosted: Fri Jul 27, 2007 7:44 am    Post subject: Reply with quote

coolguy,

You have an extra parenthesis. Look at the sql I posted .

your sql should be as follows


Code:

SELECT DATE(:WS-FILEDATE) - 1 DAYS   
      INTO :WS-FROMDATE                 
      FROM SYSIBM.SYSDUMMY1         


btw if you did search for 171 you would have found this

http://www.mvsforums.com/helpboards/viewtopic.php?t=3087&highlight=171

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
coolguy
Beginner


Joined: 01 Dec 2004
Posts: 82
Topics: 28

PostPosted: Mon Jul 30, 2007 3:24 am    Post subject: Reply with quote

Kolusu
You are correct. Thanks a lot.

Cool
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group