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
 

 

difference between dates in months Cobol

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Testing & Performance analysis
View previous topic :: :: View next topic  
Author Message
josepnass

New User


Joined: 31 Dec 2003
Posts: 16
Location: dc

PostPosted: Wed Jun 18, 2014 2:30 am    Post subject: difference between dates in months Cobol
Reply with quote

HI all ho would you find the difference in no of months between a date 09/22/2014 and 06/20/2014 in Cobol

Thanks I am having issues just an intern

John icon_eek.gif
Back to top
View user's profile Send private message

Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1609
Location: NY,USA

PostPosted: Wed Jun 18, 2014 2:44 am    Post subject:
Reply with quote

Isn't that just to take the first 2 bytes for each field, subtract and get the difference? or also you can use the intrinsic functions for DATEs.

Also, you can take the help of below link,

http://ibmmainframes.com/about9591.html
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7912
Location: Bellevue, IA

PostPosted: Wed Jun 18, 2014 3:57 am    Post subject:
Reply with quote

You need to CLEARLY define the rules -- is a difference of 1 month and 1 day to be considered 1 month, or 2 months? how about 1 month and 29 days? how about February 28 to March 1? how about February 28 to March 1 in a leap year?

If I had to do this, depending upon the exact requirement, I would probably convert both dates to days using the intrinsic function, subtract, and divide the difference by 30 with rounding. No, that would not be exact but unless the requirement is more clearly stated. in most (but not all) cases that would be close enough.

For precision, you have to iterate from the earlier date to the later date, handling February and December / January along the way.

Most sites have date handling routines LONG established and generally if such routines are available at your site -- USE THEM. Yes, they are custom to each site, but they will provide what the site requires.
Back to top
View user's profile Send private message
josepnass

New User


Joined: 31 Dec 2003
Posts: 16
Location: dc

PostPosted: Wed Jun 18, 2014 4:04 am    Post subject: no its more complex than that :-)
Reply with quote

Its more complex that that but I see what you mean .
Back to top
View user's profile Send private message
josepnass

New User


Joined: 31 Dec 2003
Posts: 16
Location: dc

PostPosted: Wed Jun 18, 2014 4:17 am    Post subject:
Reply with quote

just months so ?
Back to top
View user's profile Send private message
josepnass

New User


Joined: 31 Dec 2003
Posts: 16
Location: dc

PostPosted: Wed Jun 18, 2014 4:20 am    Post subject:
Reply with quote

what i have states if the current date is 3 mths prior from a maturity date then I do another process based on it being 3 months..
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1219
Location: Israel

PostPosted: Wed Jun 18, 2014 7:46 pm    Post subject: Reply to: difference between dates in months Cobol
Reply with quote

Full (and correct) answer depends on how your dates are stored and how they are accessed.
Just as an example, if you are reading your data from a DB2 table, you could just select the interesting rows:
Code:
SELECT  ....
FROM    ...
WHERE   MATURATION_DATE < (CURRENT DATE - 3 MONTH)
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 -> Testing & Performance analysis All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts Regarding COBOL Stored Procedure opti... selvamsrinivasan85 DB2 4 Fri Nov 04, 2016 8:57 pm
No new posts COBOL Version 6.1 Virendra Shambharkar COBOL Programming 5 Tue Nov 01, 2016 11:24 am
No new posts Cobol list of programs being called biswajit.dattagupta COBOL Programming 5 Tue Nov 01, 2016 2:10 am
No new posts Can sending 5 MB data between cobol p... Kevin Vaz CICS 12 Tue Oct 18, 2016 4:50 pm


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