I have a subroutine to check if the day is leap year or not. OUr current program is not working. Can someone read RPG and tell me why its not working? The problem is, when it comes to the first day of the month, the program makes the date as the last date of the month +1. IE June 1, 2008 = May 32, 2008.
Here's what i can see regarding the leapyear.
**************************
**********
**********
****
* SUBROUTINE ... ##DATE
**************************
**********
**********
****
C ##DATE BEGSR
* Month 01..31 January
* 02..28 February
* 02..29 February -- every Leap Year
* 03..31 March
* 04..30 April
* 05..31 May
* 06..30 June
* 07..31 July
* 08..31 August
* 09..30 September
* 10..31 October
* 11..30 November
* 12..31 December
*
C MO LOKUPTABSMM TABSDD 20
C ADD 1 DA
* Leap Year
C *IN33 IFEQ *OFF
C MO IFEQ 02
C YR ANDEQ04
C YR OREQ 08
C YR OREQ 12
C YR OREQ 16
C ADD 1 TABSDD
C MOVE *ON *IN33
C ENDIF
C ENDIF
*
C DA IFGT TABSDD
C DA SUB TABSDD DA
C MO ADD 1 MO
C MO IFGT 12
C SUB 12 MO
C ADD 1 YR
C ENDIF
C ENDIF
C ENDSR
Thanks for your help!!!
ST
Start Free Trial