Here is a simple way to find the last day of the month. You do not have to worry about which month has 30 or 31 days, or leap years.
1. Set your date to the first day of the month. Move '01' to the day portion of the date.
2. Using COBOL Intrinsic Functions (I assume RPG works the same way) to add 1 month to the date.
3. Using COBOL Intrinsic Functions, subtract 1 day from the date.
This assumes you date is within the month you want the last day. I've written a detail article if you are interested.
1. Set your date to the first day of the month. Move '01' to the day portion of the date.
2. Using COBOL Intrinsic Functions (I assume RPG works the same way) to add 1 month to the date.
3. Using COBOL Intrinsic Functions, subtract 1 day from the date.
This assumes you date is within the month you want the last day. I've written a detail article if you are interested.
Comment