Hi folks.
        I was recently playing with dates and date types in RPG IV (you
guess why :))), and have found something rather strange.

        Wrote a program to print all leap years from 1 to 9999 using
simple technique: set (*iso, but doesn't metter) date to March 01, and
SUBDUR one day from it. If it ends up with Feb 29, it's a leap year. My
program broke whenever it hit year 300. Same loop, same logic worked for
all years in range from 1 to 9999, but for 300. Further investigation
(dump and source debugger) showed that reason for it was that:

(no format)
D Ddate             s             d     DATFMT(*ISO)
D Ndate             s           8   0
C             Z-ADD   3000301     Ndate
C    *ISO     MOVE    Ndate       Ddate

set Ddate to '0300-02-29', and each subsequent use of Ddate crashes the
program, because '0300-02-29' is invalid date (300 is not lep year).

I tried later with string variables and with both numeric and string
literals, but result was the same:

C   *ISO      MOVE   3000301     Ddate  
C   *ISO0     MOVE   '03000301'  Ddate

Ddate has value of '0300-02-29'.

Even worse, adding 1 day to '0300-02-28' would result with '0300-02-29'
and than ... crash.

        I've tested it on two V3.7 and one V4.1 system, results are the
same.  Any ideas? What, so significant, had happened in 300 AD? Or
something significant (good party :))) took place that night when IBM-ers
were developing that piece of compiler? Or is it my mistake? 

Can't wait to hear from you,


| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com

This thread ...

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

This mailing list archive is Copyright 1997-2019 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].