ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

%Char in RPGLE

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

  • %Char in RPGLE

    Hello,

    I am having a problem using %Char in my program using RPGLE.

    Error issued: *RNF0386 30 1 The parameter for %CHAR is not valid.


    Here is my code:

    EVAL $CSDFEA = %Char(SDFEA)

    Definition:

    SDFEA (8,0)
    $CSDFEA (8)


    I think AS/400 version is V4R2M0.

    I dont know what is the problem, I already used that BIF in V5R2 but it works fine.


    Thanks,
    Hobert

  • #2
    Re: %Char in RPGLE

    I don't think V4R2 supports %char. If SDFEA ia 8,0 field, it should work ok. CHeck your compile listing at the top for version #. Also, check the compile listing to see what the compiler thinks SDFEA is.

    Comment


    • #3
      Re: %Char in RPGLE

      Yes I remember the %char only worked on dates back then (i think)

      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: %Char in RPGLE

        Jamie,

        BIFFs were not even introduced until V5R1.

        hobert.bertol,

        I didn't even thing the EVAL was introduced until after V4R2. Could be wrong on that one though. You could always just use MOVE.

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

        Comment


        • #5
          Re: %Char in RPGLE

          Okay now you made me do it! Im posting a link to bob's site



          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


          • #6
            Re: %Char in RPGLE

            Jamie,

            I'll be damned!! I am on that site almost every working day (as I am here ) and have never see that page! I kid you not!

            So anyway, I'm sorry. You were right and I was wrong. There, I said it...

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

            Comment


            • #7
              Re: %Char in RPGLE

              As many times as Ive been wrong.....we are not even close.........
              I just remember that I thought it was dumb back then that the %char would only
              work on dates and times........

              I spend time lurking there (rpgiv) also but dont tell anyone

              take care
              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


              • #8
                Re: %Char in RPGLE

                Hi,

                SDFEA is 8,0.

                I need to place the value in a character field (e.g $CSDFEA 8A).

                I tried this code:

                MOVE SDFEA $CSDFEA

                and it compiles but when SDFEA has negative value (e.g. -100), the value of $CSDFEA has a value something like this 000212K and sometimes 00000J (note the alpha characters K and J).

                I need to see the negative sign.. what should i do then?

                If only i can use %Char but our version here is V4R2.

                Thanks,
                Hobert

                Comment


                • #9
                  Re: %Char in RPGLE

                  something like this.....
                  the code is wrong just an idea.


                  PHP Code:
                  ~
                        *
                        *  
                  Field Definitions.
                        *
                       
                  d character9      s              9
                       d count           s              5  0
                       d decimal8        s              8  0
                       d reply           s              1
                        
                  *
                        *=============================================================
                        *  
                  M A I N     L I N E
                        
                  *=============================================================
                        *
                       
                  c                   for       count 1 to 5
                        
                  *
                       
                  c                   clear                   character9
                        
                  *
                       
                  c                   select
                       c                   when      count 
                  1
                       c                   
                  eval      decimal8 = -254
                       c                   when      count 
                  2
                       c                   
                  eval      decimal8 125458
                       c                   when      count 
                  3
                       c                   
                  eval      decimal8 6852122
                       c                   when      count 
                  4
                       c                   
                  eval      decimal8 = -25
                       c                   when      count 
                  5
                       c                   
                  eval      decimal8 100
                       c                   endsl
                        
                  *
                       
                  c                   if        decimal8 < *zeros
                       c                   
                  eval      decimal8 decimal8 * -1
                       c                   move      decimal8      character9
                       c                   movel     
                  '-'           character9
                       c                   
                  else
                       
                  c                   move      decimal8      character9
                       c                   
                  endif
                        *
                       
                  c     character9    dsply                   reply
                        
                  *
                       
                  c                   endfor
                        *
                       
                  c                   eval      *inlr = *on 
                  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

                  Working...
                  X