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 Dec 12, 2022

Relaxed string manipulation BIF's that respect SBCS, UCS and UTF-8.

Today we have nice features where we can get portions of character strings.


However, especially with support of UTF-8, the number of bytes is not always equal to the number of characters. Also - trying to extract ranges of characters not within the source string will cause raise conditions.


So a more practical solution will be appreciated.


Proposing the following new RPGLE BIF's:


%leftchar(), %rightchar(), %midtchar(), %words() and %word()


All of the above can be achieved today with %subst in combination with *NATURAL or *STDCHARSIZE, %len and %charcount. However, it is not easy to code or understand.


Idea priority Medium
  • Guest
    Reply
    |
    May 31, 2023
    IBM does not intend to provide a solution to this Idea at this time, so it is being closed.

    Thank you for taking the time to submit your Idea to have another set of built-in functions for string handling that always operate in "natural" mode.

    After careful consideration, we know that we cannot deliver your requested enhancement soon, so it is being declined. However, we believe it may have future value, so we will add it to an internal list for us to keep in mind for the future.
  • Admin
    Sabine Jordan
    Reply
    |
    Jan 19, 2023

    The CEAC has reviewed this requirement and recommends that IBM view this as a HIGH priority requirement that is important to address.

    Background: The COMMON Europe Advisory Council (CEAC) members have a broad range of experience in working with small and medium-sized IBM i customers. CEAC has a crucial 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.

    To find out how CEAC help to shape the future of IBM i, see CEAC @ ibm.biz/BdYSYj and the article "The Five Hottest IBM i RFEs Of The Quarter" at ibm.biz/BdYSZT

    Sabine Jordan + Sara Anrdres – CEAC Program Manager, IBM

  • Guest
    Reply
    |
    Jan 16, 2023
    IBM has received your Idea and is evaluating it.

    IBM will provide a response after evaluation is complete.

    Please note that there are some existing Ideas that, if implemented, would make it easier to use RPG for the use-cases, even if the new built-in functions suggested by this Idea are not implemented.

    Regarding %LEFTCHAR and %RIGHTCHAR, there is an existing Idea requesting these functions ("Add New BIF's %right() and %left()".

    See https://ibm-power-systems.ideas.ibm.com/ideas/IBMI-I-920. If this Idea is implemented, these built-in functions would behave the same as existing string functions, defaulting to process by bytes or double-bytes unless natural-mode is requested. However, %LEFT and %RIGHT would also support natural-mode to satisfy the need of the %LEFTCHAR and %RIGHTCHAR you requested.

    Regarding %MIDTCHAR, that is the same as %SUBST under natural-mode.

    Regarding %WORD and %WORDS, the existing %SPLIT function can be used to provide a similar function. If %SPLIT is assigned to a DIM(*AUTO) array with zero current elements, the number of words can be obtained by %ELEM after the assignment.

    However, %SPLIT currently defaults to ignoring extra separators, and the suggestion for the %WORD and %WORDS functions is to default to process all separators, with a suggested *SKIPDUB to indicate that it should ignore extra separators. There is an existing Idea requesting an enhancement to %SPLIT to process all separators ("%split() should return an empty element where a separator character follows another separator character"). See https://ibm-power-systems.ideas.ibm.com/ideas/IBMI-I-3007.

    Here is an example using %SPLIT with a DIM(*AUTO) array to handle the Use Case of finding the various parts of a file path. It uses %SCANR to handle the file extension.

    dcl-s words varchar(20) dim(*auto : 10);
    dcl-s p int(10);

    myFileName = '/home/user1/textfile.txt';
    %elem(words) = 0;
    words = %split(myFileName : '/');
    fileName = words(%elem(words)); // Last word
    p = %scanr('.' : fileName);
    if p in %range(1 : %len(filename) - 1);
    // There is a . in the filename
    extension = %subst(fileName : p + 1);
    endif;
    if p > 1;
    // There is something before the .
    fileNameOnly = %subst(fileName : 1 : p - 1);
    elseif p = 0;
    // There is no . in the filename
    fileNameOnly = fileName;
    endif;

    - IBM Power Systems Development