I was asked how to make sure if I added 1 month to the last day of this month I would get the end of next month. If I take a date from a month and add one month to it I get the end of the next month.
In RPG if I add one month to January 31 I get February 28, the last day of the next month.
wkDate = d’2022-01-31′ + %months(1) ;
dsply wkDate ;
DSPLY 2022-02-28
When I add one month to February 28 I do not get the last day of March, I get March 28.
wkDate = d’2022-02-28′ + %months(1) ;
dsply wkDate ;
DSPLY 2022-03-28
Read more »