PowerHouse date function not quite a bug
Deskin, Bob
Bob.Deskin@Cognos.COM
Thu, 15 Oct 1998 10:51:10 -0400
The defaulting of a date element/item to century included or excluded
depends on where the entity is defined and in what way. If you're using QDD,
a date element defaults based on the system option, but in PDL you must
specify the size (6 or 8) so there is no default. 6 means century excluded
and 8 means century included. Of course the storage datatype must be
consistent. For example, specifying a DATE SIZE 8 and a storage of ZONED
SIZE 6 doesn't work.
If you simply say DATE, you get PHDATE for century excluded and INTEGER SIZE
4 for century included. For temporary and defined date items with a datatype
of DATE, the default is based on the system option.
So if you say DEFINE d DATE, the item is based on the system option, but if
you are specific, DEFINE d DATE CENTURY INCLUDED, then that's what you'll
get.
Be careful about interpreting results from QUIZ. Remember that the century
you display may be the default century rather than what's in the item. If
you really want to see what's in the item, do this:
DEFINE x DATE = PARM
DEFINE y INTEGER SIZE 4 = x
and display both. Note that including a century in the date format (on
either side of the =) does not make the date a century included date.
PowerHouse allows you to enter a century even though it will not be stored.
The DAYS function doesn't care about the century included/excluded system
option. It computes the number of days from a base date (by default Dec 31,
1899). If the date expression has a 0 century, the default century is added.
The DATE function does not strip the century. It takes the number of days
entered and converts it to a date based on the base date of Dec 31, 1899.
Then it checks the result against the century included/excluded and default
century system options. If the system option is century included, then the
result is returned as a century included date without any further checking.
If the system option is century excluded, then the century of the result
must be equal to the default century or a data conversion error occurs. If
it's okay, the reuslt is returned as a century excluded date.
Bob Deskin
Senior Product Advisor bob.deskin@cognos.com
Cognos Inc. (613) 738-1338 ext 4205 FAX: (613) 228-3149
3755 Riverside Drive P.O. Box 9707 Stn. T, Ottawa ON K1G 4K9 CANADA
> ----------
> From: Robert J.M. Edis[SMTP:Robert.Edis@creatcomp.com]
> Sent: Thursday, October 15, 1998 9:51 AM
> To: 'powerh-l@lists.swau.edu'
> Subject: RE: PowerHouse date function not quite a bug
>
> Thanks a lot for your input Bob.
>
> I still want a couple of things spelled out though.
>
> You said if we use a DATE data type in PH when the PHD is set to CENTURY
> EXCLUDED the result will be a 6 digit date. I used this data type in a
> DEFINE ... = PARM FORMAT MMDDYYYY and the result included a century,
> either 19 or 20 as the case may be. I also used CENTURY INCLUDED on the
> DEFINE statement.
>
> The DAYS function correctly returns the right number of days, e.g.
>
> DEFINE date1 DATE CENTURY INCLUDED = PARM FORMAT MMDDYYYY
> DEFINE days1 = DAYS(date1) - 5
> DEFINE date2 DATE CENTURY INCLUDED = DATE(days1)
> REPORT date1 FORMAT MMDDYYYY &
> days1 PICTURE " ^^^,^^^" &
> date2 FORMAT MMDDYYYY
>
> DATE1 DAYS1 DATE2
> 12/31/1999 36,519 12/26/1999
> 01/01/2000 36,520 12/27/1999
> 01/06/2000 36,525 DCE
>
> As you can see, date1 stores the correct century. The number of days in
> case 3 translates to 01/01/2000. It appears to me from what you say is
> that the DATE() function strips the century (20). That's fine. But
> 01/01/1900 is a valid date.
>
> Is the result of the function actually returning 00000101, i.e. century
> zero, and this is causing the DCE?
>
>
> Blue
> = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
> =
> Subscribe: "subscribe powerh-l" in message body to
> majordomo@lists.swau.edu
> Unsubscribe: "unsubscribe powerh-l" in message to majordomo@lists.swau.edu
> powerh-l@lists.swau.edu is gatewayed one-way to bit.listserv.powerh-l
> This list is closed, thus to post to the list, you must be a subscriber.
>
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Subscribe: "subscribe powerh-l" in message body to majordomo@lists.swau.edu
Unsubscribe: "unsubscribe powerh-l" in message to majordomo@lists.swau.edu
powerh-l@lists.swau.edu is gatewayed one-way to bit.listserv.powerh-l
This list is closed, thus to post to the list, you must be a subscriber.