Re: Compute Date Duration

Simon Coulter <shc-Q/[email protected]>
Newsgroups gmane.comp.lang.as400.mi
Message-ID <[email protected]>
On 15/10/2005, at 2:27 AM, Dave McKenzie wrote:

> In the CDD documentation it says "The DDAT for operand 1 must be valid 
> for a date duration."
>
> In the list of format codes it lists "Date duration" (x14) as separate 
> from the "Labeled durations" (x0D - x13).
>
> Maybe that means that the only valid format code for operand 1 is x14.

We'd know more if we got to see the MCH5601 message in its entirety. 
I'm inclined to agree with you. CDD returns a "Date Duration". Compare 
that with DECD and INCD which both accept a Duration for Operand 3. 
"Duration" being more generic implies that labelled duration might be 
valid. The DECD and INCD instructions also state that the DDAT for 
Operand 3 must be valid for a date duration like CDD does but note the 
use of italics in the description for each instruction:
	CDD:	... resulting <i>date duration</i> is placed in operand 1.
	DECD:	... is decrememted by the date <i>duration</i> specified by 
operand 3.
	INCD:	... is incremented by the date <i>duration</i> specified by 
operand 3.

CDD implies a a specific Date Duration (i.e., x'14'). DECD and INCD 
imply any kind of date duration (e.g., x'0d' to x'13). Subtle 
distinction but perhaps enough to explain the behaviour. Time for some 
experimentation I think--but, it's the weekend and the sun is shining 
out of a clear blue sky.
	Spring has sprung
	The grass has riz
	I wonder where the boidies is

> In any case, I don't know exactly what a "labeled duration" is.

A date duration is an 8-digit value interpreted as YYYYMMDD but it's 
not a DATE even though it looks like one. It is a duration of YYYY 
years, MM months, and DD days.

A "labelled duration" is just a number. It can be interpreted as years, 
months, days (for the DATE types) according to the format code. The 
format code specifies the "label" applied to the number.

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

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


_______________________________________________
This is the MI Programming on the AS400 / iSeries (MI400) mailing list
To post a message email: MI400-Zwy7GipZuJhWk0Htik3J/[email protected]
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/mi400
or email: MI400-request-Zwy7GipZuJhWk0Htik3J/[email protected]
Before posting, please take a moment to review the archives
at http://archive.midrange.com/mi400.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.