× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



OK. Here's what some experimentation shows:

CDD will calculate a duration between character format dates. This is consistent with the CDD instruction description which states that operands 2 and 3 must be character scalars. That means the only valid date types for operands 2 and 3 are:
        USA
        ISO
        EUR
        JIS
        System Internal Date (Scaliger number)
        *MMDDYY
        *DDMMYY
        *YYMMDD
        *YYDD
        *YYYYDDD

Default separators are required for the first 5 but the last 5 can have any separator or no separator as long as the DDAT correctly describes the separator. If the specified date value does not match the DDAT then MCH1222 will occur.

NOTE:- The scaliger number specified for the System Internal Date type must not exceed the end date of the Calendar (else MCH1221) nor must it be earlier than the start date of the Calendar (else MCH1224).

CDD does not support other date formats so if you have dates in other formats (e.g. packed or zoned numeric) you must first convert them to a format that CDD does support.

Most DDAT errors will cause MCH1867 but some will cause MCH5601. Errors in the first 58 bytes of the template will cause MCH5601.

CDD always returns a Date Duration. That is an 8,0 packed decimal value in the form YYYYMMDD which is interpreted as YYYY years, MM months, and DD days. Specifying any other format type will result in MCH5601.

I also discovered that if the Calendar Table is not allowed for a particular format type (such as Date Duration) then if you specify zero for the Calendar Offset you can omit the Calendar Table entirely.

However the Era Table must be present (and set to X'00' for a Date Duration) otherwise MCH1867 is sent with reason code 19

Further the DDAT_List_Size (as distinct from the DDAT_Length which can be anything including zero) is validated for being greater than 0 but otherwise seems to tolerate incorrect values. Not that I'm advocating doing so but it is interesting. When it is zero the #cfdate module gets the DDAT number wrong in MCH1867. It shows 16448 which is the value of an uninitialised BIN(2).

So that just leaves the question of how to convert a Date Duration to a Labelled Duration and that can be done with maths.

I haven't found an MI instruction that will generate a Labelled Duration. They seem to be valid only as input to the various INC and DEC instructions.

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  / \
--------------------------------------------------------------------



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.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 on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.