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
 

 

how to calculate FINAL-END-DATE?

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

New User


Joined: 11 Apr 2006
Posts: 93

PostPosted: Mon May 05, 2008 3:20 pm    Post subject: how to calculate FINAL-END-DATE?
Reply with quote

I will get the START-DATE and END-DATE from main program.Now i want to develop a sub program.
The START-DATE is default with an CURRENT-DATE and format is YYYYMM.But the end date is comming from maonprogram like MM(Num of months only no year).For example the START-DATE is 200505 and END-DATE is 15(MM) months back,how to calucate the fianl end date in this senario?

MOVE CURRENT-DATE TO START-DATE.
here start dat is 200805.
MOVE 15 TO END-DATE
here end date is 15 months.
I need to less the 15 months from the start-date but the end-date fprmat is MM(not YYYYMM).

BUt i need to calucate the fianl date with YYYYMM How we can do it in cobol program?
Back to top
View user's profile Send private message

guptae

Moderator


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

PostPosted: Mon May 05, 2008 3:32 pm    Post subject:
Reply with quote

Hello babu,

Please find the below algo

10 STARTDATE.
15 START-YEAR PIC 9(4).
15 START-MNTH PIC 9(2).
10 FINALDATE.
15 FINAL-YEAR PIC 9(4).
15 FINAL-MNTH PIC 9(2).
DIVIDE END-DATE BY 12 GIVING WW-YEAR REM WW-MNTH.
COMPUTE FINAL-YEAR = START-YEAR- WW-YEAR.
IF WW-MNTH > START-MNTH
COMPUTE FINAL-YEAR =FINAL-YEAR-1
COMPUTE START-MNTH=START-MNTH+12
END-IF.
COMPUTE FINAL-MM=START-MNTH - WW-MNTH

Please check the syntaxs as i m not touch in COBOL now meanwhile i will search if we can use some function for this.

Hope it will helpful
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