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

Regarding Date Comparison


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
prashantshinde

New User


Joined: 25 Nov 2005
Posts: 49
Location: Pune

PostPosted: Thu Sep 28, 2006 6:16 pm
Reply with quote

I have two dates in MMDDYYYY.
I want to calculate the difference in Days of these two dates.
Is there any function/utility/tool to calculate this difference instead of writing the new code for it.
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Thu Sep 28, 2006 7:03 pm
Reply with quote

Hi !

If you're having DB2 installed in your environment an you are used to it,
you could do tis by using DB2-Command in Programm.

Regards, UmeySan
Back to top
View user's profile Send private message
chandru_g

New User


Joined: 07 Mar 2006
Posts: 5

PostPosted: Thu Sep 28, 2006 9:19 pm
Reply with quote

There is no function in COBOL to do this.... we will have to implement this in the program!
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Thu Sep 28, 2006 10:55 pm
Reply with quote

You can check out this link in the cobol manual INTEGER-OF-DATE

You will have to convert the date from MMDDYYYY to YYYYMMDD, but this should be simple. Get the Integer of date for both dated and subtract.

Dave
Back to top
View user's profile Send private message
prashantshinde

New User


Joined: 25 Nov 2005
Posts: 49
Location: Pune

PostPosted: Fri Sep 29, 2006 10:31 am
Reply with quote

Dave,

Thanks.

It would be better if you give one example of how to use the
Function INTEGER-OF-DATE in the program
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Fri Sep 29, 2006 10:40 am
Reply with quote

Hi Prashanth,

INTEGER-OF-DATE Returns INTEGER equivalent of Gregorian date passed.

MOVE FUNCTION INTEGER-OF-DATE (your-julian-date in yyyymmdd format of first date ) TO WS-DATE1

MOVE FUNCTION INTEGER-OF-DATE (your-julian-date in yyyymmdd format of Second date ) TO WS-DATE2

COMPUTE DATDIFF = WS-DATE2-WS-DATE1

Hope it will helpful
Back to top
View user's profile Send private message
prashantshinde

New User


Joined: 25 Nov 2005
Posts: 49
Location: Pune

PostPosted: Fri Sep 29, 2006 10:53 am
Reply with quote

Ekta,

Thanks for Immediate help.
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Fri Sep 29, 2006 11:31 am
Reply with quote

Prashanth,

Glad I could help You
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
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
No new posts Insert system time/date (timestamp) u... DFSORT/ICETOOL 5
Search our Forums:

Back to Top