|
|
| Author |
Message |
babu_hi
Active User
Joined: 11 Apr 2006 Posts: 66
|
|
|
|
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 |
|
 |
References
|
Posted: Mon May 05, 2008 3:20 pm Post subject: Re: how to calculate FINAL-END-DATE? |
 |
|
|
 |
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1013 Location: Bangalore,India
|
|
|
|
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 |
|
 |
|
|