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 Delivered
Workspace IBM i
Categories Languages - RPG
Created by Guest
Created on Aug 6, 2020

Make %subst and %len operate on characters for UTF-8 and UTF-16

Since V7R2 RPG supports UTF-8 and UTF-16 data. That is very nice, however, its usefulness is limited by the fact that %len and %subst operate on bytes instead of characters. That makes it practically impossible to process a UTF-8 of UTF-16 string by character.

This could be solved by either:
- Adding an extra parameter to definition keywords VARCHAR and VARUCS2 to specify that not only the number of bytes, but also the number of characters should be stored. Then %len and %subst could be made to operate on characters, specificially for strings that are defined this way.
- Adding an extra parameter to %len and %subst to specify that they should operate on characters.
- Introducing new data types (VAR)UTF8 and (VAR)UTF16. And make %len and %subst operate on characters for the new data types, of course.


Use Case:

This:

for i = 1 to %len(string);
chr = %subst(string: i: 1);
<do something with chr>
endfor;

is a simple way to process a string by character. But it does not work on UTF-8 or UTF-16, when it contains characters that consist of more than 1 or 2 characters respectively.


Idea priority Medium
  • Guest
    Reply
    |
    Dec 1, 2022

    IBM believes that the solution for the Idea described is available for 7.4 and 7.5 with the following PTFs:



    7.4:


    ILE RPG Runtime: 5770SS1 SI81729


    ILE RPG Compiler, TGTRLS(*CURRENT): 5770WDS SI81749


    7.5: << Note that this release number was corrected on 2023-01-06 -- it had been incorrectly stated as "7.3".


    ILE RPG Runtime: 5770SS1 SI81740


    ILE RPG Compiler, TGTRLS(*CURRENT): 5770WDS SI81801


    ILE RPG Compiler, TGTRLS(V7R4M0): 5770WDS SI81819



    Warning: The runtime PTF is needed on any system where a program is run that uses the new function.



    Several ways are provided to request that RPG perform string operations by characters rather than the default of counting by bytes or double bytes. See https://www.ibm.com/support/pages/node/6827067.



    Note that the %LEN built-in function is not affected; %LEN continues to count by bytes or double bytes. Instead, a new built-in function %CHARCOUNT is added.



    - IBM Power Systems Development

  • Guest
    Reply
    |
    Oct 11, 2022
    IBM agrees with the Idea and a solution appears to be desirable and feasible. IBM intends to provide a solution. However, IBM's plans may change and no commitment is made that a solution will be provided.

    If this Idea is implemented, several ways will be provided to request that RPG perform string operations by characters rather than the default of counting by bytes or double bytes. See https://www.ibm.com/support/pages/node/6827067.

    Note that the %LEN built-in function will not be affected; %LEN will continue to count by bytes or double bytes. Instead, a new built-in function %CHARCOUNT will be added.

    - IBM Power Systems Development
  • Guest
    Reply
    |
    Jan 26, 2021

    The CAAC has reviewed this requirement and recommends that IBM view this as a high priority requirement that is important to be addressed. Although there is an SQL solution as an alternative, and there are very clunky work-arounds, there is no RPG native solution. For those who need to support multi-national languages, this is a gap that should be closed. Any mode of input from a browser can hit this problem with use of emojis or any DBCS language.

    Background: The COMMON Americas Advisory Council (CAAC) members have a broad range of experience in working with small and medium-sized IBM i customers. CAAC has a key role in working with IBM i development to help assess the value and impact of individual RFEs on the broader IBM i community, and has therefore reviewed your RFE.

    For more information about CAAC, see www.common.org/caac

    For more details about CAAC's role with RFEs, see http://www.ibmsystemsmag.com/Blogs/i-Can/May-2017/COMMON-Americas-Advisory-Council-%28CAAC%29-and-RFEs/

    Nancy Uthke-Schmucki - CAAC Program Manager

  • Guest
    Reply
    |
    Aug 19, 2020

    IBM will use this request as input to planning but no commitment is made or implied. This request will be updated in the future if IBM implements it. IBM will use votes and comments from others in the community to help prioritize this request.