INTEGER-OF-DAY Function [ HP COBOL II/XL Reference Manual ] MPE/iX 5.0 Documentation
HP COBOL II/XL Reference Manual
INTEGER-OF-DAY Function
The INTEGER-OF-DAY function converts a date in the Gregorian calendar
from Julian date form (YYYYDDD) to integer date form. The function type
is integer.
Syntax
FUNCTION INTEGER-OF-DAY (parameter-1)
Parameters
parameter-1 Must be an integer of the form YYYYDDD, whose value
is obtained as follows:
(YYYY * 1000) + DDD
where YYYY represents the year in the Gregorian
calendar and must be an integer greater than 1600.
DDD represents the day of the year and must be a
positive integer less than 367. DDD must be valid
for the year specified.
Return Value
The returned value is an integer that is the number of days the date
represented by parameter-1 succeeds December 31, 1600 in the Gregorian
calendar.
Example
The following example shows both the INTEGER-OF-DAY and DAY-OF-INTEGER
functions. First the year-day form of the date is converted to an
integer using INTEGER-OF-DAY. This integer represents the number of days
since December 31, 1600. Then 30 is added to the integer form and it is
converted back to the year-day form using DAY-OF-INTEGER.
01 INT-DATE PIC 9(8) VALUE ZERO.
01 DATE-TODAY PIC 9(7) VALUE ZERO.
01 DUE-DATE PIC 9(7) VALUE ZERO.
:
MOVE 1991051 TO DATE-TODAY.
COMPUTE INT-DATE = FUNCTION INTEGER-OF-DAY (DATE-TODAY).
DISPLAY DATE-TODAY.
DISPLAY INT-DATE.
ADD 30 TO INT-DATE.
COMPUTE DUE-DATE = FUNCTION DAY-OF-INTEGER (INT-DATE).
DISPLAY INT-DATE.
DISPLAY DUE-DATE.
The above example displays the following values. The first two lines
represent the date February 20, 1991. February 20 is the 51st day of
1991. The last two lines represent March 22, 1991, 30 days later. March
22 is the 81st day of 1991:
1991051
00142484
00142514
1991081
MPE/iX 5.0 Documentation