I had written a procedure that did something like that a while back.
Unfortunately, I don't have access to that right now but I can give you
the idea behind it.
I called it my 'knuckle' routine. If you count the knuckle and the space
in between your knuckle on your hands, starting with your first knuckle
as January, each knuckle you hit is a month with 31 days. All other
months had 30 days (except February).
It goes something like this.
05 MONTH-CHECK PIC 99.
88 KNUCKLE VALUES "01","03","05","07","08","10","12".
88 NOT-KNUCKLE VALUES "02","04","06","09","11".
IF KNUCKLE THEN DAYS = 31
ELSE IF MONTH <> FEBRUARY THEN
DAYS = 30
So, using that, we can do the following -
IF KNUCKLE AND DAY = 31 THEN
DISPLAY "LAST DAY OF MONTH"
IF NOT-KNUCKLE AND DAY = 30 THEN
DISPLAY "LAST DAY OF MONTH"
Can't remember how I handled February but you get the jist.
Rick 'who works for a law firm so knows better than to jump in on the
lawyer jokes' Clark
Senior Analyst
WW&R
Cleveland, Ohio
Therm-O-Link wrote:
>
> Is there an easy way to determine if today is the last day of the
> current month?
>
> I know I can do it with some effort by coding a series of IF statements
> and checking what the current month is and if the current day is 31 or
> 30 or 29 or 28 (depending on the month and whether the current year is
> a leap year or not), but I'd like to do it in and easier (and hopefully)
> more efficient manner.
>
> Jim Phillips Manager of Information Systems
> E-Mail: [log in to unmask] Therm-O-Link, Inc.
> Phone: (330) 527-2124 P. O. Box 285
> Fax: (330) 527-2123 Garrettsville, Ohio 44231
|