Skip to Main Content
IBM Power Ideas Portal


This portal is to open public enhancement requests against IBM Power Systems products, including IBM i. To view all of your ideas submitted to IBM, create and manage groups of Ideas, or create an idea explicitly set to be either visible by all (public) or visible only to you and IBM (private), use the IBM Unified Ideas Portal (https://ideas.ibm.com).


Shape the future of IBM!

We invite you to shape the future of IBM, including product roadmaps, by submitting ideas that matter to you the most. Here's how it works:

Search existing ideas

Start by searching and reviewing ideas and requests to enhance a product or service. Take a look at ideas others have posted, and add a comment, vote, or subscribe to updates on them if they matter to you. If you can't find what you are looking for,

Post your ideas
  1. Post an idea.

  2. Get feedback from the IBM team and other customers to refine your idea.

  3. Follow the idea through the IBM Ideas process.


Specific links you will want to bookmark for future use

Welcome to the IBM Ideas Portal (https://www.ibm.com/ideas) - Use this site to find out additional information and details about the IBM Ideas process and statuses.

IBM Unified Ideas Portal (https://ideas.ibm.com) - Use this site to view all of your ideas, create new ideas for any IBM product, or search for ideas across all of IBM.

ideasibm@us.ibm.com - Use this email to suggest enhancements to the Ideas process or request help from IBM for submitting your Ideas.

Status Not under consideration
Workspace IBM i
Categories Languages - RPG
Created by Guest
Created on Nov 19, 2019

Enhance %DEC / %INT / %FLOAT to recognize and accept negative values in a Zoned format

Currently, the %DEC and %INT BIFs do not recognize an ending character of "}"/"J"/.../"R" as representing a digit with a X'D' in the zone portion of the character. Thus, the character representation of a NEGATIVE number — as may be created by %EDITC(num:'X') — causes runtime error RNX0105 ("A character representation of a numeric value is in error.").

It would be quite helpful — and eliminate in code conversions laborious manual intervention to intercept negative values — if these BIFs would recognize these ten special non-numeric characters, when appearing in the last position of a character string, as valid digits, and set the result field as a negative number.

As this change could impact current functionality (for example, no longer "rejecting" [via runtime error] a value like "5N" when in fact it does represent invalid data), it might be best to implement this change via requirement for an explicit request that this should occur — such as a fourth parameter. Additional restrictions may also be appropriate (like not allowing a minus sign at the same time).

IMHO, it would also make the RPG language a bit "cleaner" with %EDITC('X') and %DEC being proper inverses of each other.


Use Case:

Assign a negative value to a numeric field; say numField1 PACKED(9:4)) = -525.25.
Assign %EDITC(numField1 : 'X') to a character field, say charField1 CHAR(12). charField1 becomes "00525250}bbb".
Try to "reconvert" the character string back to a number, say numField2=%DEC(charField1 : 9 : 4). Rather than setting numField2 to -525.25, RNX0105 occurs, presumably because the "}" is not considered as a valid numeric character.


Idea priority Medium
  • Guest
    Reply
    |
    Apr 24, 2020

    IBM does not intend to provide a solution to this request at this time, so it is being closed.

    This request does not align with the strategy for future investment in the ILE RPG compiler.

    %DEC and %EDITC are not intended to be complete inverses of each other. %DEC is intended to interpret a character string containing a fully-edited value with sign and decimal point. %EDITC with the 'X' edit code produces the equivalent of a zoned decimal value, but without the implied decimal position of a true zoned decimal value.

    We suggest writing a subprocedure to get the numeric value from a character field containing a zoned decimal value. Calling the following procedure with the value '1234N' returns -12345.

    dcl-proc getZonedVal export;
    dcl-pi *n zoned(63:0);
    parm varchar(63) const;
    end-pi;
    dcl-ds zonedDs qualified;
    a char(63);
    z zoned(63) overlay(a);
    end-ds;
    dcl-s zeros char(63) inz(*zeros);
    evalr zonedDs.a = zeros + %trim(parm);
    return zonedDs.z;
    end-proc;

  • Guest
    Reply
    |
    Dec 10, 2019

    Instead of using %EDITC(num:'X') you dould use %EDITC(num:'P')

    giving you a leading minus character