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
 

 

Calculate n number of months old date

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
amandeep

New User


Joined: 05 Mar 2010
Posts: 2
Location: India

PostPosted: Fri Mar 05, 2010 4:55 pm    Post subject: Calculate n number of months old date
Reply with quote

Hi All,

I need to calculate 24 number of months old date from current gregorian /julian date. Can anybody help?
Back to top
View user's profile Send private message

sbprem1

New User


Joined: 05 Mar 2010
Posts: 5
Location: Chennai

PostPosted: Fri Mar 05, 2010 6:09 pm    Post subject: Reply to: Calculate n number of months old date
Reply with quote

Well, you can use DB2 built-in functions as follows:

SET :DATEHV = ADD_MONTHS('2000-2-28', 4);

SET :ADD_MONTH = ADD_MONTHS(:DATE,3);
Back to top
View user's profile Send private message
amandeep

New User


Joined: 05 Mar 2010
Posts: 2
Location: India

PostPosted: Fri Mar 05, 2010 6:12 pm    Post subject:
Reply with quote

Sorry I forgot to mention that I need this in cobol , I am not using DB2 icon_smile.gif
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Fri Mar 05, 2010 7:06 pm    Post subject:
Reply with quote

What, exactly, are you having trouble with? If you don't know how to do date calculations, you probably should go back to whoever taught you COBOL and ask for a refund since IF and SUBTRACT are both basic COBOL statements. So is getting the current date.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Fri Mar 05, 2010 9:20 pm    Post subject:
Reply with quote

To be honest, I just don't understand the question? What is being asked, after all?
Quote:
calculate 24 number of months old date from current gregorian /julian date
what does "24 number of months" mean? There are only 12 month sI know of! icon_neutral.gif
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


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

PostPosted: Fri Mar 05, 2010 9:22 pm    Post subject:
Reply with quote

What about partial months?
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10210
Location: italy

PostPosted: Fri Mar 05, 2010 9:24 pm    Post subject: Reply to: Calculate n number of months old date
Reply with quote

OK i' ll bite!
why not simply subtract 2 from the years part
yyyymmdd - 24 months = yyyymmdd - 2 years
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts TOT & DATE parameter in ICEMAN hemanthj642 DFSORT/ICETOOL 4 Mon Nov 14, 2016 5:19 am
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
This topic is locked: you cannot edit posts or make replies. Get correct date and time when curren... balaji81_k DB2 24 Fri Oct 14, 2016 10:40 pm
No new posts How to calculate an specific transact... lind sh CICS 2 Tue Sep 13, 2016 9:20 pm
No new posts Change date (DD/MM/YY) in 2nd record ... uday kiran DFSORT/ICETOOL 12 Wed Sep 07, 2016 10:57 pm


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