× 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.


  • Subject: RE: Year 300 bug in ILE RPG or ...? (Again)
  • From: "Jon Erickson" <jonerickson@xxxxxxxxxxxxxxxxxxxx>
  • Date: Tue, 26 May 1998 09:29:39 -0700
  • Importance: Normal

I was able to perform this another way using TEST(D). See the following
code:

D NextYears       S               D   DatFmt(*USA)
D                 DS
D TestDate                       8  0
D  TestMoDay                     4  0 OverLay(TestDate:1) Inz(0229)
D  TestYear                      4  0 OverLay(TestDate:5) Inz(0001)

 *------------------------------------------------------------------------*
C                   Except    Header
C                   DoU       TestYear = *Zero

C     *USA          Test(D)                 TestDate               20
C                   If        Not *In20
C     *USA          Move      TestDate      NextYears
C                   Except    LeapYear
C                   EndIf
C                   Add       1             TestYear
C                   EndDo

Hth
Regards,
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Jon A. Erickson
Viking Industries, Inc.
http://www.vikingindustries.com
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


> -----Original Message-----
> From: owner-rpg400-l@midrange.com [mailto:owner-rpg400-l@midrange.com]On
> Behalf Of jovic@calcna.ab.ca
> Sent: Sunday, May 24, 1998 9:20 AM
> To: rpg400-l@midrange.com
> Subject: Year 300 bug in ILE RPG or ...? (Again)
>
>
>
>       For some strange reason, my previous message was cut and came
>  incoplete. Here is the full version.
>
>       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
> or
> 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,
>
> Vanya
>
>
>
> * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
> * This is the RPG/400 Discussion Mailing List!  To submit a new         *
> * message, send your mail to "RPG400-L@midrange.com".  To unsubscribe   *
> * from this list send email to MAJORDOMO@midrange.com and specify       *
> * 'unsubscribe RPG400-L' in the body of your message.  Questions should *
> * be directed to the list owner / operator: david@midrange.com          *
> * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
>


begin 666 Jon Erickson.vcf
M0D5'24XZ5D-!4D0-"E9%4E-)3TXZ,BXQ#0I..D5R:6-K<V]N.TIO;CL[.PT*
M1DXZ2F]N($5R:6-K<V]N#0I/4D<Z5FEK:6YG($EN9'5S=')I97,[26YF;W)M
M871I;VX@4WES=&5M<PT*5$E43$4Z4W(N(%!R;V=R86UM97(@06YA;'ES= T*
M5$5,.U=/4DL[5D])0T4Z*#4P,RD@-C8W+38P,S @>#4U, T*5$5,.TA/344[
M5D])0T4Z*#4P,RD@-C4X+3<U.#D-"E1%3#M#14Q,.U9/24-%.B@U,#,I(#,P
M-RTW-C4U#0I414P[5T]22SM&05@Z*#4P,RD@-C8Y+3$Q,S4-"D%$4CM73U)+
M.CL[,3@V,# @3BY%+B!7:6QK97,@4F0N.U!O<FQA;F0[3U([.3<R,S M-CDY
M-3M5;FET960@4W1A=&5S(&]F($%M97)I8V$-"DQ!0D5,.U=/4DL[14Y#3T1)
M3D<]455/5$5$+5!224Y404),13HQ.#8P,"!.+D4N(%=I;&ME<R!29"X],$0]
M,$%0;W)L86YD+"!/4B Y-S(S,"TV.3DU/3!$/3!!56YI=&5D(%-T871E<R!O
M9B!!;65R/0T*:6-A#0I!1%([2$]-13H[.S$U,S,T(%-%($]R96=O;B!4<F%I
M;"!$<BX[0VQA8VMA;6%S.T]2.SDW,#$U.U5N:71E9"!3=&%T97,@;V8@06UE
M<FEC80T*3$%"14P[2$]-13M%3D-/1$E.1SU154]4140M4%))3E1!0DQ%.C$U
M,S,T(%-%($]R96=O;B!4<F%I;"!$<BX],$0],$%#;&%C:V%M87,L($]2(#DW
M,#$U/3!$/3!!56YI=&5D(%-T871E<R!O9B!!;64]#0IR:6-A#0I!1%([4$]3
M5$%,.CL[4"Y/+B!";W@@,C U,3@[4&]R=&QA;F0[3U([.3<R.30M,#4Q.#M5
M;FET960@4W1A=&5S(&]F($%M97)I8V$-"DQ!0D5,.U!/4U1!3#M%3D-/1$E.
M1SU154]4140M4%))3E1!0DQ%.E N3RX@0F]X(#(P-3$X/3!$/3!!4&]R=&QA
M;F0L($]2(#DW,CDT+3 U,3@],$0],$%5;FET960@4W1A=&5S(&]F($%M97)I
M8V$-"E523#H-"E523#IH='1P.B\O=W=W+G!C97HN8V]M+WYE=V%R90T*0D1!
M63HQ.38P,3(P- T*14U!24P[4%)%1CM)3E1%4DY%5#IJ;VYE<FEC:W-O;D!V
M:6MI;F=I;F1U<W1R:65S+F-O;0T*14U!24P[24Y415).150Z97=A<F5 <&-E
H>BYC;VT-"E)%5CHQ.3DX,#0P-U0Q-#,X,3E:#0I%3D0Z5D-!4D0-"@``
`
end


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This is the RPG/400 Discussion Mailing List!  To submit a new         *
* message, send your mail to "RPG400-L@midrange.com".  To unsubscribe   *
* from this list send email to MAJORDOMO@midrange.com and specify       *
* 'unsubscribe RPG400-L' in the body of your message.  Questions should *
* be directed to the list owner / operator: david@midrange.com          *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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

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