The %%$WCALC function performs a shift from the specified date to a working date in the specified calendar, according to indicated instructions. The format of the %%$WCALC function is:
%%$WCALC date instruction calendar
where:
date – must be (or resolve to) a date in format yyyymmdd
instruction – shift instructions.
Valid values are:
+n – Shift to the next nth working date in the calendar.
–n – Shift to the previous nth working date in the calendar.
> – If the specified date is not a current working date, shift to the next working date in the calendar. (If the specified date is a working date, do not shift.)
< – If the specified date is not a current working date, shift to the previous working date in the calendar. (If the specified date is a working date, do not shift.)
calendar – name of the calendar to check for working dates
Example
//* %%SET %%A=%%$WCALC 20000717 +1 EXCPTCAL
//* %%SET %%A=%%$WCALC 20000717 > EXCPTCAL
If calendar EXCPTCAL (for 2000) contains consecutive working dates 07/13 and 07/20, %%A resolves to 20000720 in both %%SET statements.
If calendar EXCPTCAL (for 2000) contains consecutive working dates 07/17 and 07/24:
In the first %%SET statement (with the +1), %%A resolves to 20000724.
In the second %%SET statement (with the >), %%A resolves to 20000717.
Note: If, in the (resolved) date yyyymmdd, the value of dd exceeds the valid range for the month mm, it is treated as if a dd value of the last day of the month had been specified and the calculation is done accordingly.