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

date arithematic in db2


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

Moderator Emeritus


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

PostPosted: Thu Oct 09, 2008 8:57 am
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
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
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

Moderator Emeritus


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

PostPosted: Thu Oct 09, 2008 10:05 pm
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
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: 6966
Location: porcelain throne

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

maybe var1 is the problem.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Mon Oct 13, 2008 1:02 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Need help to append a date&tsp at... DFSORT/ICETOOL 9
No new posts Fetch data from programs execute (dat... DB2 3
Search our Forums:

Back to Top