501-CHECK-LEAP-YEAR

The 501-CHECK-LEAP-YEAR routine counts one for each leap year that falls between the two input dates.

Note: Years that end in 00 are not counted as leap years, unless the year ending in 00 is divisible by 400.
Library DATERTNS

Required Input

Field Type and length Definition
DATE-1 N 8 First date.*
DATE-2 N 8 Second date.*

If the input date century equals 00, it changes to 19 or 20. See Century Parameter Processing.

Output

Field Type and length Definition
DAYS-DIFFERENCE N 6 Number of leap years between DATE-1 and DATE-2.

Example

*       Count leap years between start and stop dates.
        MOVE start-date                   TO DATE-1.
        MOVE stop-date                    TO DATE-2.
        MOVE ZERO                         TO DAYS-DIFFERENCE.
        PERFORM 501-CHECK-LEAP-YEAR.