Information Technology Reference
In-Depth Information
end-if
end-if
end-if
february-check:
leap-switch
= “n”
if
date-yyyy
(3:2) = 0
then
if mod
(
date-yyyy
, 400) = 0
leap-switch
= “y”
end-if
else
if
mod
(
date-yyyy
(3:2), 4) = 0
leap-switch
= “y”
end-if
end-if
if
work-dd
> 29 or
leap-switch
= “n”
date-switch
= 5
end-if
We also
need the variables from the define statement
define
date-work
structure
date-yyyy
integer
(4)
date-mm
integer
(2)
date-dd
integer
(2)
define
date-switch
integer
define
leap-switch
character
to make this all work.
To get started we have to set the variable
date-switch
to 0 and
date-work
to the value of the date that we are checking. The next step is to perform
check-date
.
Note that the resulting values from 1 to 6 for
date-switch
mean that the date is invalid, with the following meanings:
1 - date not numeric
2 - day out of range
3 - month out of range
4 - 0 is invalid for the year
5 - invalid day for February
6 - that month has only 30 days.