ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Date format to char conversion in rpg

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

  • Date format to char conversion in rpg

    I have beeen receiving a date timestamp error in my rpgle at a statement:

    result=%char(field:*iso)

    where result is 10A and field is of D format type.

    I have been pushing a iso type value eg: '2013-05-05' into field, yet the timestamp issue persists.

    Any ideas?

  • #2
    Re: Date format to char conversion in rpg

    Looks good. What is the value of field when it gets unhappy?
    Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply

    Comment


    • #3
      Re: Date format to char conversion in rpg

      My computer says this in debug, so it works. What's your errormessage?:

      1 H option(*nodebugio)
      2 H debug decedit('0,') datedit(*DMY/)
      3 D dat s d inz(d'2013-05-01')
      4 D res s 10a
      5 c eval res = %char(dat:*iso)
      6 c return
      Fine
      Debug . . .

      F3=Fine programma F6=Aggiunta/eliminazione punto interruzione F10=Passo
      F11=Visual. variabile F12=Ripresa F24=Altri tasti
      RES = '2013-05-01'

      Comment


      • #4
        Re: Date format to char conversion in rpg

        no.

        Start debug, call progarm, when it blows up , show what the value in the field is.

        It is possible that the field has bad data, regardless of it being a date type.
        Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply

        Comment


        • #5
          Re: Date format to char conversion in rpg

          Hi DeadManWalks,

          This thing worked normal on second try.Weird enough.The value i saw in debug on first try was field='2013-03-03' same as was passed from cl. Anyway thanks for the response.

          Comment


          • #6
            Re: Date format to char conversion in rpg

            Originally posted by techas400 View Post
            This thing worked normal on second try.Weird enough.
            That kind of error can happen with programs that have been changed and recompiled. A pointer can still reference an old version in QRPLOBJ, or an activation group might not be reclaimed in a job.

            Then, it can seem as if it "just started working."

            Tom
            Tom

            There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

            Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

            Comment

            Working...
            X