MIDRANGE dot COM Mailing List Archive



Home » MIDRANGE-L » July 2008

Re: Dynamically Assigning A Value To A Date Filed



fixed


On 04/07/2008, at 8:17 PM, IWilson@xxxxxxxxxxxxxxxxxx wrote:

I have the following defined in a PRGILE program.

D TestDate S D DatFmt(*iso) INZ(D'2008-07-04')

However what I want to do is assign a value to TestDate at runtime.

ie Something like

Eval TestDate = '2008-07-04'


Can't find anything about how to do this and when I try it
I get a compile time message that the left and right type are not the
same.

TestDate is a date (D) data type but '2008-07-04' is a character (A) data type so ...

First point: The compiler is rarely wrong ... so ...

Second point: You need to tell the compiler to interpret the character data as a date.

There are a number of ways to do that but since you are using a literal constant refer back to how you instructed the compiler to initialise the data field correctly.

Third point: You already know how to do this.

Regards,
Simon Coulter.
--------------------------------------------------------------------
FlyByNight Software OS/400, i5/OS Technical Specialists

http://www.flybynight.com.au/
Phone: +61 2 6657 8251 Mobile: +61 0411 091 400 /"\
Fax: +61 2 6657 8251 \ /
X
ASCII Ribbon campaign against HTML E-Mail / \
--------------------------------------------------------------------








Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2014 by MIDRANGE dot 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 here. If you have questions about this, please contact