× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



From: Leif Svalgaard <leif@leif.org>

I left in some unncessary code (in this context). Try this instead:\

> From: Taylor, Mike <Mike.Taylor@aig.com>
> > What is the easiest way to convert a date to julian format.
>
> you could use some of the date APIs (although they are not easy!).
> If you can read COBOL, here is some code that will do it:
>
>  01  VARIOUS-VARIABLES.
>      02  NBR-DAYS                PIC S9(7)  COMP.
>      02  NBR-YEARS               PIC S9(7)  COMP.
>      02  NBR-LEAPS               PIC S9(7)  COMP.
>      02  YEAR-DIV                PIC S9(5)  COMP.
>      02  NBR-MONTHS              PIC S9(3)  COMP.
>      02  LEAP-YEAR               PIC S9(3)  COMP.
>      02  YEAR-REM                PIC S9(3)  COMP.
>
>      02  CALENDAR-GRE-DATE.
>          03  GRE-YYYY            PIC 9(4).
>          03  GRE-MM              PIC 9(2).
>          03  GRE-DD              PIC 9(2).
>      02  FILLER                  REDEFINES  CALENDAR-GRE-DATE.
>          03  GRE-YYYYMMDD        PIC 9(8).
>
>      02  CALENDAR-JUL-FORM.
>          03  JUL-YYYY            PIC 9(4).
>          03  JUL-DDD             PIC 9(3).
>      02  FILLER                  REDEFINES  CALENDAR-JUL-FORM.
>          03  JUL-YYYYDDD         PIC 9(7).
>
>  01  DAYS-AT-MONTHS.
>      02  FILLER                  PIC S9(3)  COMP VALUE ZERO.
>      02  FILLER                  PIC S9(3)  COMP VALUE 31.
>      02  FILLER                  PIC S9(3)  COMP VALUE 59.
>      02  FILLER                  PIC S9(3)  COMP VALUE 90.
>      02  FILLER                  PIC S9(3)  COMP VALUE 120.
>      02  FILLER                  PIC S9(3)  COMP VALUE 151.
>      02  FILLER                  PIC S9(3)  COMP VALUE 181.
>      02  FILLER                  PIC S9(3)  COMP VALUE 212.
>      02  FILLER                  PIC S9(3)  COMP VALUE 243.
>      02  FILLER                  PIC S9(3)  COMP VALUE 273.
>      02  FILLER                  PIC S9(3)  COMP VALUE 304.
>      02  FILLER                  PIC S9(3)  COMP VALUE 334.
>  01  FILLER                      REDEFINES  DAYS-AT-MONTHS.
>      02  DAYS-AT-MONTH           PIC S9(3)  COMP
>                                             OCCURS 12 TIMES.
>  CONVERT-TO-JULIAN.
>      MOVE GRE-YYYY                   TO NBR-YEARS
>      MOVE GRE-MM                     TO NBR-MONTHS
>      COMPUTE NBR-DAYS = DAYS-AT-MONTH (NBR-MONTHS) + GRE-DD
>      PERFORM CHECK-IF-LEAP-YEAR
>      IF NBR-MONTHS > 2
>          ADD LEAP-YEAR TO NBR-DAYS
>      .
>      MOVE NBR-YEARS TO JUL-YYYY
>      MOVE NBR-DAYS  TO JUL-DDD
>      .
>
>  CHECK-IF-LEAP-YEAR.
>      MOVE ZERO TO LEAP-YEAR
>      DIVIDE 4 INTO NBR-YEARS
>          GIVING    YEAR-DIV
>          REMAINDER YEAR-REM
>      IF YEAR-REM = ZERO
>          MOVE 1 TO LEAP-YEAR
>
> You can probably omit the following (if you are not dealing
> with dates before 1901 or after 2099)
>
>          DIVIDE 100 INTO NBR-YEARS
>              GIVING      YEAR-DIV
>              REMAINDER   YEAR-REM
>          IF YEAR-REM = ZERO
>              DIVIDE 400 INTO NBR-YEARS
>                  GIVING      YEAR-DIV
>                  REMAINDER   YEAR-REM
>              IF YEAR-REM > ZERO
>                  MOVE ZERO TO LEAP-YEAR
>      .




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.