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

Author Message
karnataka

New User

Joined: 15 Sep 2006
Posts: 20
Location: bangalore

 Posted: Mon May 21, 2007 11:20 am    Post subject: How to calculate 6 months previous date from the given date hi, can any body tell, how to calculate 6 months previous date from the given date. eg: given-date => 12-12-2006 6 months-previous-date==>12-06-2006 Thanks .....

sandeep1dimri

New User

Joined: 30 Oct 2006
Posts: 76

 Posted: Mon May 21, 2007 11:25 am    Post subject: Hi You can check your shop's library :-) as in every shop one can find date modules so why to recode the logic :-) If you could not find it out then we will try for pseudeo code Thanks Sandeep
Aji

New User

Joined: 03 Feb 2006
Posts: 53
Location: Mumbai

 Posted: Mon May 21, 2007 12:35 pm    Post subject: Re: date calculation Hi Please check this one. 01 year1. 02 yy pic 9(4). 02 mm pic 99. 02 dd pic 99. 01 year2. 02 yy1 pic 9(4). 02 mm1 pic 99. 02 dd1 pic 99. Procedure Division. if mm > 6 move yy to yy1 move dd ti dd1 Compute mm1 = mm - 6 enf-if. if mm < 7 Compute yy1 = yy - 1 move dd to dd1 Compute mm1 = mm + 6 end-if. Display year2. Aji Cherian
kgumraj

Active User

Joined: 01 May 2006
Posts: 151
Location: Hyderabad

Posted: Mon May 21, 2007 10:42 pm    Post subject:

Hi,

You can code with a query

 Code: EXEC SQL          SELECT (:WS-DATE - 6 MONTHS)          INTO :WS-DATE-MOD          FROM SYSIBM.SYSDUMMY1 END-EXEC
karnataka

New User

Joined: 15 Sep 2006
Posts: 20
Location: bangalore

 Posted: Tue May 22, 2007 4:59 pm    Post subject: Thanks a lot...
sagard

New User

Joined: 16 May 2007
Posts: 4
Location: Pune

 Posted: Tue May 22, 2007 8:47 pm    Post subject: Following query should also work EXEC SQL SELECT (CURRENT DATE - 6 MONTHS) INTO :WS-DATE-MOD FROM SYSIBM.SYSDUMMY1 END-EXEC 'Current Date' is a db2 Special register which stores the current date.
agkshirsagar

Active Member

Joined: 27 Feb 2007
Posts: 686
Location: Earth

 Posted: Wed May 23, 2007 2:50 pm    Post subject: sagard, question was about 'given date' not about current date.
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Fetching data from JHS as per the cur... arunsoods All Other Mainframe Topics 4 Wed Nov 22, 2017 1:54 pm Date in where clause - Windows Karthikeyan Subbarayan DB2 9 Wed Nov 15, 2017 9:07 pm Compare yesterday's date to the one o... migusd SYNCSORT 11 Fri Sep 22, 2017 11:35 pm it is possible output a SET value fro... Martylin JCL & VSAM 6 Fri Sep 22, 2017 7:08 am Fetch Previous month & year in MM... girishb2 DFSORT/ICETOOL 3 Thu Sep 21, 2017 9:54 pm

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