Dates in Strings

Darren Reely darren_reely@latticesemi.com
Mon, 19 Oct 1998 16:33:00 -0700


A better description, I hope.  Thanks to those who have answer so far.
Unfortunately the solutions do not get me to where I want to be.

I have two problems here.  One is getting the 3 character month.  I can't find
a better way to that.

The other problem is to get around the fact that even with  varchar types, quiz
uses the defined size in output when the content might be shorter.  This makes
sense to me.  So I cannot build it the way I want at my heading statement,
because I'll have spacing I do not want. Also you cannot use the truncate (or
any) function in the report statement.  Here is a simplified example:

define date1 date = sysdate
define char1 varchar*40 = "Date:"

report tab 1 char1 date1 format mmmddyyyy sep "-"

result is:

Numbers are to show spacing
                  1                  2                  3
4                  5
12345678901234567890123456789012345678901234567890

Date:
Oct-19-1998

What I want is:

Date: Oct-19-1998


Thanks,

Darren.



Darren Reely wrote:

> Hi All,
>
> I'm trying to build a string in Quiz so on a single header line the
> output will look like:
>
>    ProdClass TProduct 16V8D-15QJ  Ship Date Range: From MAR-22-1998  To
> OCT-19-1998  Cust Name John Doe
>
> Below is some test code that works.  Is there an easier way to get the
> dates in that long format from date types?  I thought there was a way to
>
> directly get the character month from a date, but can't find it under
> Sun.  Maybe I'm thinking about VMS Lexicals.
>
> I'm using Powerhouse 8.13.C on Sun Solaris 2.5.  I'm looking at cutting
> down my work load for our Y2K project.
>
> Thanks,
>
> Darren Reely
>
> set page width 132
>
> define p_from_ship_date date = parm prompt "From Date: "
> define p_to_ship_date date = parm prompt "To Date: "
>
> define d_LatMonthStr char*36 = "JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC"
>
> define d_from_ship_month char*3 &
>      = d_LatMonthStr[(dateextract(p_from_ship_date, MONTH) * 3) - 2 :3]
> define d_to_ship_month char*3 &
>      = d_LatMonthStr[(dateextract(p_to_ship_date, MONTH) * 3) - 2 :3]
>
> define prod_type char*6 = "T"
> define p_product char*16 = "16V8D-15QJ"
> define p_cust_name char*25 = "John Doe"
>
> define d_selects char*100 = &
>   "ProdClass " + truncate( prod_type ) &
>   + "Product " + truncate( p_product ) &
>   + "  Ship Date Range: From " + d_from_ship_month + "-" &
>                               + ascii(p_from_ship_date,8)[7:2] + "-" &
>                               + ascii(p_from_ship_date,8)[1:4] &
>   + "  To " + d_to_ship_month + "-" &
>             + ascii(p_to_ship_date,8)[7:2] + "-" &
>             + ascii(p_to_ship_date,8)[1:4] &
>   + "  Cust Name " + trunc(p_cust_name)
>
> report d_selects
>
> = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
> 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.