A retirement, or a death?
Going to San Francisco?

How to check those dates

Legislation in the US will soon be signed to expand the scope of Daylight Savings Time, the twice-a-year event that forces HP 3000 owners to adjust their system clocks. The new law will push the DST switchback one week later in this year, as well as start DST three weeks earlier next year. All those programs you had worked out to slowly change the 3000's clocks in October and April will have to be revised for November and March. You can get a good start with this article by John Burke from our net.digest archives.

While you're working at that, you may find yourself looking over your HP 3000's date routines. HP's got a DATECONVERT intrinsic to get the date format of Julian or Gregorian. Kathleen Mc Rae of HP pointed a user to sample code recently for using DATECONVERT. The HP IT Response Center has the sample in the document KBRC00015373.

There's also a way to extract the current date in Julian format using the functions INTEGER-OF-DATE and DATE-OF-INTEGER. Mc Rae recently explained how to use these functions with a COBOL sample up on the 3000-L newsgroup.

Mc Rae said:

Function INTEGER-OF-DATE converts a date in YYYYMMDD format to an integer date equivalent, starting with January 1, 1601, of the Gregorian calendar.  Function DATE-OF-INTEGER does the opposite, converting an integer date to its standard date equivalent.

INTEGER-OF-DATE
INTEGER-OF-DAY
DATE-OF-INTEGER
DAY-OF-INTEGER

$control POST85
IDENTIFICATION DIVISION.
PROGRAM-ID. PROG.
AUTHOR.
DATE-WRITTEN.
DATE-COMPILED. SAME.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 GREGORIAN-DATE     PIC S9(8) BINARY.
77 DATE-OF-INT        PIC S9(8) BINARY.
77 DAY-OF-INT         PIC S9(8) BINARY.
77 INT-OF-DATE        PIC S9(8) BINARY.
77 INT-OF-DAY         PIC S9(8) BINARY.
PROCEDURE DIVISION.
ONLY-PARA.
     DISPLAY 'INPUT DATE IN FORMAT YYYYMMDD'.
     ACCEPT GREGORIAN-DATE FREE.
     DISPLAY 'THE DATE ENTERED WAS: ' GREGORIAN-DATE.
     COMPUTE INT-OF-DATE =
             FUNCTION INTEGER-OF-DATE (GREGORIAN-DATE).
     DISPLAY 'INTEGER-OF-DATE RETURNED: ' INT-OF-DATE.
     COMPUTE DAY-OF-INT =
             FUNCTION DAY-OF-INTEGER (INT-OF-DATE).
     DISPLAY 'DAY-OF-INTEGER RETURNED: ' DAY-OF-INT.
     COMPUTE INT-OF-DAY =
             FUNCTION INTEGER-OF-DAY (DAY-OF-INT).
     DISPLAY 'INTETGER-OF-DAY RETURNED: ' INT-OF-DAY.
     COMPUTE DATE-OF-INT =
             FUNCTION DATE-OF-INTEGER (INT-OF-DAY).
     DISPLAY 'DATE-OF-INTEGER RETURNED: ' DATE-OF-INT.
STOP RUN.

Sample run of the program:


INPUT DATE IN FORMAT YYYYMMDD
20050705
THE DATE ENTERED WAS: +20050705
INTEGER-OF-DATE RETURNED: +00147744
DAY-OF-INTEGER RETURNED: +02005186
INTETGER-OF-DAY RETURNED: +00147744
DATE-OF-INTEGER RETURNED: +20050705

The longer the HP 3000 sticks around, the more important date manipulations will be to its users. The server already hosts a lot of the longest-lived data in the industry. Not every platform in the business world is so well-tooled to accept changes in time; the AS/400s running older versions of OS400 struggled with this task.

You also need to be sure your 3000's timezone is set correctly. Shawn Gordon explained back in 1999 how his scheduled job takes care of that:

"You only have to change TIMEZONE.  For SUNDAY in my job scheduler I have the following set up to automatically handle it:

IF HPMONTH = 10 AND HPDATE > 24 THEN
   ECHO We are going back to Standard Time
   SETCLOCK TIMEZONE = W8:00
ENDIF
IF HPMONTH = 4 AND HPDATE < 8 THEN
   ECHO Setting clock for Daylight Savings Time
   SETCLOCK TIMEZONE = W7:00
ENDIF

3000 customers say that the help text for SETCLOCK can be confusing:

      SETCLOCK  {DATE= date spec; TIME= time spec [;GRADUAL | ;NOW]}
                {CORRECTION= correction spec [;GRADUAL | ;NOW]}
                {TIMEZONE= time zone spec}
                {;CANCEL}

Orbit Software's pocket guide for MPE/iX explains shows the correct syntax. In this case, ;GRADUAL and ;NOW may only be applied as modifiers to the DATE=; TIME= keywords, not to ;CORRECTION=.

Comments