ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Simple question?

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

  • Simple question?

    Hi,

    Try to do the following and get the error when create a module.


    If tdate <> %date() <- error in this statement
    goto bskip
    Endif

    The field tdate is in ISO format


    Error Message:Operands are not compatible with the type of operator.


    Am I missing something? the input file internal discribed.



    Thanks!

  • #2
    Re: Simple question?

    That should work...or at least it did for me.

    What OS version are you on? Since %date is only availabel since V5r1
    You don't stop playing games because you get old, You get old because you stop playing games!

    Comment


    • #3
      Re: Simple question?

      She/he said the input file was internally described...I dont think its an *ISO date like
      0001-01-01 but 8,0

      but we really dont have enough info.

      to convert 8,0 to iso

      PHP Code:
      ~
      d isoDate         s               d      
      c                   
      eval      IsoDate = %date(CheckDate:*ISO
      Also I think I saw a GOTO there



      jamie
      All my answers were extracted from the "Big Dummy's Guide to the As400"
      and I take no responsibility for any of them.

      www.code400.com

      Comment


      • #4
        Re: Simple question?

        Hi,

        The program is converted from old code, here is the I-spec for the file

        0017.00 I 1 1 TYPE
        0018.00 I 2 11 TDATE <- field use in the IF statement
        0019.00 I 12 19 TTIME

        If look at the file the field is like ISO format - 2006-01-01

        Thanks!






        Originally posted by jamief
        She/he said the input file was internally described...I dont think its an *ISO date like
        0001-01-01 but 8,0

        but we really dont have enough info.

        to convert 8,0 to iso

        PHP Code:
        ~
        d isoDate         s               d      
        c                   
        eval      IsoDate = %date(CheckDate:*ISO
        Also I think I saw a GOTO there



        jamie

        Comment


        • #5
          Re: Simple question?

          Jackie,

          Try this:

          Code:
          If %DATE( tdate : *ISO ) <> %DATE()
          But the question remains, can you even do this? As MikeS asked, what OS version are you on?

          HTH,
          MdnghtPgmr
          "Tis better to be thought a fool then to open one's mouth and remove all doubt." - Benjamin Franklin

          Comment


          • #6
            Re: Simple question?

            Just because it looks like a date, doesn't make it one. It has to be a "date data type". Using the suggested options should convert it to a date field so you can compare.

            Comment


            • #7
              Re: Simple question?

              Hi,

              Thanks for all of you and it works now!!



              Originally posted by arrow483
              Just because it looks like a date, doesn't make it one. It has to be a "date data type". Using the suggested options should convert it to a date field so you can compare.

              Comment


              • #8
                Re: Simple question?

                Originally posted by Jackie
                Hi,

                Thanks for all of you and it works now!!
                Good - I hope you got rid of the GOTO while you were at it!

                Comment


                • #9
                  Re: Simple question?

                  And I thought I was the only one thinking that...

                  Comment


                  • #10
                    Re: Simple question?

                    That is the problem with fixing old programs. I agree, ban GOTO from the any programming language.
                    Never trust a dog to watch your food.

                    Comment

                    Working...
                    X