ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

fields zoned

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

  • fields zoned


    Hi,

    I have a flat file, which I am reading by doing a SUBSTR and passing the values to a zoned field without decimal, declared:

    d wReg2N s 63s 0
    d f2 $ s 50a

    When the SUBSTR of the flat file, I get this value:
    F2 $ = '22806982806982906982 '

    When I pass it to the variable Zoned without decimal
    wReg2n =% int (f2 $);

    I get this error:

    The receiver value is too small to contain the result => MCH1210

    I've read that a zoned field can have up to 30 occupied positions, but here I only have 20.

    Why is this happening? How can I move this value to this field?

  • #2
    The maximum value for an integer is 9223372036854775807
    You can see this in "integer format" on page 200 in the ILE RPG Language Reference V7R1 manual.

    The value 22806982806982906982 is too big.

    Regards
    Peder

    Comment


    • #3
      Originally posted by Peder Udesen View Post
      The maximum value for an integer is 9223372036854775807
      You can see this in "integer format" on page 200 in the ILE RPG Language Reference V7R1 manual.

      The value 22806982806982906982 is too big.

      Regards
      Peder

      Thanks, I just saw that it is an error, so create a validation to control that error .. Thank you very much

      Comment


      • #4
        wReg2n = %Dec(f2:20:0) ;

        Comment


        • #5
          Use %DEC to handle up to 63 digits.

          Code:
          wReg2n =%DEC (f2 : 63: 0);

          Comment


          • #6
            Originally posted by CRinger400 View Post
            wReg2n = %Dec(f2:20:0) ;
            Thanks CRinger400

            Comment


            • #7
              Originally posted by Barbara Morris View Post
              Use %DEC to handle up to 63 digits.

              Code:
              wReg2n =%DEC (f2 : 63: 0);
              Thanks Barbara!

              Comment

              Working...
              X