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
 

 

date arithematic in db2

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

New User


Joined: 01 Mar 2005
Posts: 20

PostPosted: Thu Oct 09, 2008 8:45 am    Post subject: date arithematic in db2
Reply with quote

Hi

In db2 i am doing a date arithematic ,

Case 1:-
--------
select date(:ws-hold-da) - 11 months into var1 from sys1.sysdummy

The above querry is working fine,

Case 2:-
----------
select date(:ws-hold-da) - (:ws-hold-month-da) months into var1
from sys1.sysdummy

I moved number of months from the input file to ws-hold-month-da,
instead of number 11 of case 1; i am using host variable in case 2,
here i am getting problem because of host variable ;

Can some one please help me how to do this date arithematic.

Thanks,
Srikanth
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: Thu Oct 09, 2008 8:57 am    Post subject:
Reply with quote

Hello,

Quote:
here i am getting problem because of host variable ;
Can some one please help me how to do this date arithematic.
Not until you post the problem. . .

Telling us "it did not work" provides nothing to work with.

Have you provided the info requested in your other topic about cobol/sql?

If would be good to work on one issue at a time rather than using a shotgun approach. . .
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Thu Oct 09, 2008 5:48 pm    Post subject:
Reply with quote

What is the definition of ws-hold-month-da?
Back to top
View user's profile Send private message
i_suman

New User


Joined: 01 Mar 2005
Posts: 20

PostPosted: Thu Oct 09, 2008 5:54 pm    Post subject: ws-hold-month-da is a pic 9(2) value zeroes variable
Reply with quote

ws-hold-month-da is a pic 9(2) value zeroes variable ; which is getting
populated from input file; input file will have number of months in it;
for eg:- 12 months , 22 months etc...
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: Thu Oct 09, 2008 10:05 pm    Post subject:
Reply with quote

Hello,

When do you think you might mention the problem you are having?

Part of getting help from the forums is following the directions you are given. . . icon_sad.gif
Back to top
View user's profile Send private message
stodolas

Active Member


Joined: 13 Jun 2007
Posts: 632
Location: Wisconsin

PostPosted: Sun Oct 12, 2008 7:05 pm    Post subject:
Reply with quote

It appears that the date math can't take the working storage field when executed with a cursor.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Mon Oct 13, 2008 12:30 am    Post subject:
Reply with quote

maybe var1 is the problem.
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: Mon Oct 13, 2008 1:02 am    Post subject:
Reply with quote

Srikanth,

We'll try yet again. . . .

Quote:
here i am getting problem because of host variable ;


Quote:
maybe var1 is the problem.
Almost surely. . .

Quote:
When do you think you might mention the problem you are having?
It has only been 5 days since you were asked to post your problem. You do realize that you still have not posted what error/problem you are having. . . Are you technically unable or merely unwilling to post the actual problem you want help with?
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 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
No new posts LISTIDR compiled date/time jerryte IBM Tools 3 Thu Apr 20, 2017 7:37 pm
No new posts SUBSTR for Date functions Shaheen Shaik DB2 4 Thu Apr 06, 2017 2:14 pm
No new posts Date and time format in CICS Chandru3183 CICS 2 Sat Mar 18, 2017 12:46 pm


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