900-INCREMENT-DATE

900-INCREMENT-DATE takes an input date and processes up to three incremental computations and returns the increment date.

Library CALRTNS

Input

Field Type and length Definition
WSDR-FR-DATE A 8

From date (yyyymmdd).

WSDR-FR-DATE increments the year and month first to calculate an intermediate date before incrementing the day. The intermediate date must be a valid date. Then, it determines if the original day is still valid in the intermediate month/year. If day is less than 29, it is always valid, but if 29 or greater the intermediate month could be a month with fewer days than the day in the WSDR-FR-DATE . If day is greater than the days in the intermediate month, it is adjusted to the last day of the month unless WSDR-EOM-ROLLOVER = "Y" in which case the intermediate date is set to the first of the following month.

An increment of (0,0,0) returns WSDR-FR-DATE equals WSDR-TO-DATE , unless century equals 00, in which case the century part of WSDR-TO-DATE is set even though it is not set in WSDR-FR-DATE .

WSDR-YEAR-INCR A 5 Year increment can be positive or negative in range of -200 to +200.
WSDR-MONTH-INCR A 5 Month increment can be positive or negative in range of -2400 to +2400.
WSDR-DAY-INCR A 5 Day increment can be positive or negative in range of -3200 to +3200.
WSDR-EOM-ROLLOVER A 1

End of month controls direction when intermediate day is too large.

"Y" = roll to first of next month

"N" = roll back to end of month

WSDR-EOM-ROLLOVER only has an effect if the original day exceeds the EOM of the intermediate month/year. This occurs when the day in the WSDR-FR-DATE exceeds the numbers of days in the intermediate month. For example, adding one month to August 31 creates an intermediate date in September and the intermediate date must be corrected since September 31 is an invalid date. If WSDR-EOM-ROLLOVER equals "N," it becomes September 30 adding ten days returns October 10.

WSDR-EOM-ROLLOVER has no effect when the day in the WSDR-FR-DATE forms a valid intermediate date.

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

Output

Field Type and length Definition
WSDR-TO-DATE A 8

To date (yyyymmdd)

Valid date calculated on the increments provided that can be used as input on subsequent calls.

WSDR-ERROR-NBR N 9

Error number.

See Error Number.

WSDR-ERROR-VAR A 20 Input parameter is in error.

Programming Example

       MOVE WS-PEA-EFFECT-DATE         TO WSDR-FR-DATE.
       MOVE ZEROES                     TO WSDR-YEAR-INCR
                                          WSDR-MONTH-INCR.
       MOVE 1                          TO WSDR-DAY-INCR.
       MOVE "Y"                        TO WSDR-EOM-ROLLOVER.
       PERFORM 900-INCREMENT-DATE.
       MOVE WSDR-TO-DATE               TO DBRNG-BEG-DATE.