HP3000-L Archives

February 1999, Week 1

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Walter Murray <[log in to unmask]>
Reply To:
Walter Murray <[log in to unmask]>
Date:
Wed, 3 Feb 1999 18:24:29 GMT
Content-Type:
text/plain
Parts/Attachments:
text/plain (42 lines)
Ben ([log in to unmask]) wrote:
: In the ALMANAC intrinsic, I am supposed to supply a date as a 16 bit
: unsigned integer by value.  The date format, per HP's help files, is 7:9
: Day of Year, and 0:7 Year of Century.  It looks like year of century
: means the 2 digit year without the century.

: Perhaps I am missing the point, but how am I supposed to fit 5 bytes
: into a 16 bit field for COBOLII?

: Any help on how I should use this intrinsic, or just some help on
: defining and using the date part, would be greatly appreciated.  For
: some reason the HP help files have no examples, just syntax for the
: actual statement.

I'll respond, since you mentioned COBOL II.

You can certainly fit those 5 bytes into that 16-bit field if you
really want to.  Bit manipulation in COBOL II is facilitated by the
new routines HP_BYTE_PACK and HP_BYTE_UNPACK (documented in the 5.5
PowerPatch 5 Communicator).

But I suspect you are making your job unnecessarily difficult.  The
ALMANAC intrinsic is usually used when you already have a date in
that special 16-bit format (because you have just called the CALENDAR
intrinsic, for example) and you want to convert it to year, month,
and day.

It sounds like maybe you already have the year and day-of-year, and
want to get the month and day.  If so, it would be easier to use the
COBOL functions INTEGER-OF-DAY and DATE-OF-INTEGER.  You would convert
from YYYYDDD to an integer date form, and then convert that integer
to YYYYMMDD.

By the way, the documentation of that 16-bit date format is wrong.
Bits 0:7 are not the year of the century.  They are the number of
years since 1900.  It hasn't made much difference yet, but it soon
will!  :-)

Walter Murray
Hewlett-Packard
Support Technology Lab

ATOM RSS1 RSS2