Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
amandeep

New User

Joined: 05 Mar 2010
Posts: 2
Location: India

 Posted: Fri Mar 05, 2010 4:55 pm    Post subject: Calculate n number of months old date Hi All, I need to calculate 24 number of months old date from current gregorian /julian date. Can anybody help?

sbprem1

New User

Joined: 05 Mar 2010
Posts: 5
Location: Chennai

 Posted: Fri Mar 05, 2010 6:09 pm    Post subject: Reply to: Calculate n number of months old date 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);
amandeep

New User

Joined: 05 Mar 2010
Posts: 2
Location: India

 Posted: Fri Mar 05, 2010 6:12 pm    Post subject: Sorry I forgot to mention that I need this in cobol , I am not using DB2
Robert Sample

Global Moderator

Joined: 06 Jun 2008
Posts: 8337
Location: Dubuque, Iowa, USA

 Posted: Fri Mar 05, 2010 7:06 pm    Post subject: 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.
Anuj Dhawan

Senior Member

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

Posted: Fri Mar 05, 2010 9:20 pm    Post subject:

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!
Craq Giegerich

Senior Member

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

 Posted: Fri Mar 05, 2010 9:22 pm    Post subject: What about partial months?
enrico-sorichetti

Senior Member

Joined: 14 Mar 2007
Posts: 10478
Location: italy

 Posted: Fri Mar 05, 2010 9:24 pm    Post subject: Reply to: Calculate n number of months old date OK i' ll bite! why not simply subtract 2 from the years part yyyymmdd - 24 months = yyyymmdd - 2 years
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Question about dataset sequence numbe... harisukumaran JCL & VSAM 23 Tue May 29, 2018 9:31 am INVALID RECFM FOR DDNAME SYSLIN AND C... sandeep kumar302 All Other Mainframe Topics 7 Fri Apr 27, 2018 6:07 pm Repeat Sequence Number Until change i... rahulabvp DFSORT/ICETOOL 6 Thu Mar 29, 2018 12:51 pm add sequence number for duplicate rec... SRUTHI DRAVIDAMANI COBOL Programming 11 Thu Feb 22, 2018 5:37 pm PARSE GDG name to separate generation... Abid Hasan SYNCSORT 2 Sun Feb 11, 2018 3:40 pm

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us