ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Date calculation error message

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Date calculation error message

    In my program, I have the statement
    Code:
    CMOPDT = %Dec(%Date(CUS_ACC_OPN_YYMD:*ISO):*MDY);
    The RDI debugger shows a value of 20690701 in field CUS_ACC_OPN_YYMD:

    Click image for larger version

Name:	RPG01.jpg
Views:	0
Size:	54.0 KB
ID:	144532

    I am getting an RPG error that states the year portion of a Date or Timestamp value is not in the correct range but it also says the range for a 4 digit year must be 0001-9999.
    Click image for larger version

Name:	RPG02.jpg
Views:	0
Size:	86.7 KB
ID:	144533

    The year portion of the date that produced the error is clearly in that range, so I am wondering why I am getting a hard error. I can code around it bevcause it obviously was a typ-o but it shouldn't produce a hard error, I would think.

    Any ideas why it produces a hard error.


  • #2
    Break it into 2 statements and see if the error is in the *MDY conversion.

    Code:
    MyISODate = %Date(CUS_ACC_OPN_YYMD:*ISO) ; 
    CMOPDT = %Dec(MyISODate:*MDY) ;
    Ringer

    Comment


    • #3
      I get the same thing in either code. So this is interesting...
      It happens at the convert from *MDY..
      Last edited by CaptainRon; March 9, 2017, 10:53 AM.

      Comment


      • #4
        The allowable year range for a date conversion to *MDY format (mm/dd/yy - note the 2 digit year) is 1940 to 2039 so the year 2069 falls outside of that range. If you wanted a 4 digit year, try the *USA format.

        Comment


        • #5
          Dog darn it Brian, finally a question I knew the answer to... and you answered first. One answer point to you.

          Comment


          • #6
            Sorry. If it's any consolation, I know how you feel. I come in later in the morning and by then all of the easy questions are answered.

            Comment

            Working...
            X