DAY-OF-INTEGER Function [ HP COBOL II/XL Reference Manual ] MPE/iX 5.0 Documentation
HP COBOL II/XL Reference Manual
DAY-OF-INTEGER Function
The DAY-OF-INTEGER function converts a date in the Gregorian calendar
from integer date form to Julian date form (YYYYDDD). The function type
is integer.
Syntax
FUNCTION DAY-OF-INTEGER (parameter-1)
Parameters
parameter-1 Is a positive integer that represents a number of
days succeeding December 31, 1600 in the Gregorian
calendar.
Return Value
The returned value represents the Julian equivalent of the integer
specified in parameter-1.
The returned value is an integer of the form YYYYDDD, where YYYY
represents a year in the Gregorian calendar and DDD represents the day of
that year.
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