ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Conv 23 Character field to 23 numeric field

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

  • Conv 23 Character field to 23 numeric field

    I need to convert a 23 character field to 23 decimal field.

    abc has the value '20060106170111137000001';

    def is declared as zoned decimal (23,0)

    when i am using this statement

    def = %int(abc)

    I am getting a runtime error with status code 103 indicating, 'An intermediate result is not large enough to contain the result.'

    So, i declared a data structure 'xyz' containing 'def' as a subfiled.

    And moved the field 'abc' to data structure 'xyz' to convert it. And it's working.

    Is there any way to convert 23 character filed to numeric field.

  • #2
    Re: Conv 23 Character field to 23 numeric field

    Maximum length Int can convert is 20 only.

    Pls go thro
    IBM i, COZZI, Community, RPG IV, SQL, CL, ILE, Training, Forum, SQL Query File, Query/400, DB2


    for Range and Use of the Integer (I) Data Types in RPG IV.
    Thanks,
    Giri

    Comment


    • #3
      Re: Conv 23 Character field to 23 numeric field

      Use %Dec instead.

      example code:

      D inp S 23A Inz('01234567890123456789012')
      D onp S 23 0
      /free
      onp = %Dec(inp:23:0) ;
      *INLR = *ON ;
      /end-free
      Thanks,
      Giri

      Comment


      • #4
        Re: Conv 23 Character field to 23 numeric field

        OK.. Flying by the seat of my pants here.. but what are the limits of a "Numeric" type? I thought it would go above 20. Yes? No?

        (Sorry.. I've only had 1/2 cup of coffee .. .and thinking isn't my strong point yet!)

        Comment


        • #5
          Re: Conv 23 Character field to 23 numeric field

          A decimal field has a limit of 63 (64?), its the integer type that is causing you problems.

          Comment

          Working...
          X