U@INCRDATE
U@INCRDATE takes an input date and processes up to three incremental computations and returns the increment date.
Module | CALRTNS |
Input
Field | Type and length | Definition |
---|---|---|
E@DRFRDATE | A 8 |
From date (yyyymmdd). E@DRFRDATE 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 E@DRFRDATE. If day is greater than the days in the intermediate month, it is adjusted to the last day of the month unless E@DREOMROLLOVR = "Y" in which case the intermediate date is set to the first of the following month. An increment of (0,0,0) returns E@DRFRDATE equals E@DRTODATE, unless century equals 00, in which case the century part of E@DRTODATE is set even though it is not set in E@DRFRDATE. |
E@DRYEARINCR | A 5 | Year increment can be positive or negative in range of -200 to +200. |
E@DRMONTHINCR | A 5 | Month increment can be positive or negative in range of -2400 to +2400. |
E@DRDAYINCR | A 5 | Day increment can be positive or negative in range of -3200 to +3200. |
E@DREOMROLLOVR | 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 E@DREOMROLLOVR only has an effect if the original day exceeds the EOM of the intermediate month/year. This occurs when the day in the E@DRFRDATE 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 E@DREOMROLLOVR equals "N," it becomes September 30 adding ten days returns October 10. E@DREOMROLLOVR has no effect when the day in the E@DRFRDATE 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 |
---|---|---|
E@DRTODATE | A 8 |
To date (yyyymmdd) Valid date calculated on the increments provided that can be used as input on subsequent calls. |
E@DRERRORNBR | N 9 |
Error number. See Error Number |
E@DRERRORVAR | A 20 | Input parameter is in error. |
Programming Example
|