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 Future consideration
Workspace IBM i
Categories Languages - RPG
Created by Guest
Created on May 25, 2021

Dynamic Strings in RPG

Have the ability to declare a character very similar to how we declare a string in Java without having to give it a length.


Use Case:

In Java to declare a string its just
String mytext;

In RPG I would like to declare a char as
dcl-s myText char;

Maybe the only way to do it would be over varchars and with a special operator code, so something like
dcl-s myText varchar dynamic;

This would tell the compiler that myText could be any size up to the max internal limit.


Idea priority Medium
  • Guest
    Reply
    |
    May 22, 2023

    If it is dynamic you cannot then put it in a datastructure that have a contained size, thus diminishing the value greatly.

    If you use a pointer to represent it, you create a whole set of consequences, like deep/shallow copy problem of DS, missing references because lazy allocated etc.

    RPG is mainly value based when working with datastructures, and this is a good thing for representing data in business logic (it is typically the most idiomatic way).


    Please don't "evolve" RPG into Java !!! ;) See the mess and the hoops Java must go into just to "simulate" struct value types.

    By not declaring the size of a string, you are just pushing the problem elsewhere. And usually, for real work, like writing to a database or call a REST service, you have a finite size to work with, that must be defined by protocol.


  • Guest
    Reply
    |
    Nov 30, 2021

    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.

    If this feature is implemented, the compiler would support *MAX as the length for a CHAR, UCS2, GRAPH, VARCHAR, VARUCS2, or VARGRAPH definition.

  • Guest
    Reply
    |
    Aug 31, 2021

    IBM has received the requirement and is evaluating it. IBM will provide a response after evaluation is complete.

    If this is implemented, it would likely -not- be available for subfields.

  • Guest
    Reply
    |
    Jul 27, 2021

    The CAAC has reviewed this requirement and recommends that IBM view this as a medium priority requirement that should be addressed. Agreeing with CEAC comment below, this enhancement will help RPG to move forward with modern business cases where dynamic sizes get more important.

    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

    Nancy Uthke-Schmucki - CAAC Program Manager

  • Guest
    Reply
    |
    Jul 12, 2021

    The CEAC has reviewed this requirement and recommends that IBM view this as a HIGH priority requirement that is important to address. This enhancement will help RPG to move forward with modern business cases where dynamic sizes get more important. Example web requests and unstructured data.

    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

    Therese Eaton – CEAC Program Manager, IBM

  • Guest
    Reply
    |
    May 28, 2021

    @Barbara Morris
    My response related to the description in Details: "Have the ability to declare a character very similar to how we declare a string in Java without having to give it a length."
    I was trying to keep the focus on this in order not to hijack this RFE.

    Anyways I agree that *MAX could be very usefull.
    I would also like to have it for arrays like DIM(*MAX) giving the highest possible value within the 16MB limit.

  • Guest
    Reply
    |
    May 27, 2021

    IBM has modified some of the information in this request. Please contact us if you have any questions.

    Per Submitter's request, the value in the Source field has been changed from "None" to "COMMON".

  • Guest
    Reply
    |
    May 27, 2021

    @PederUdeson, I am wondering why it would be better to have a null-terminated string than a varchar?

    To find the length of a null-terminated string, the entire string must be searched for the null character. This can impact performance if the string is very long. With a varchar sttring, the length is known immediately.

    Also, I think it is likely that programmers would want all three string types, VARCHAR, VARUCS2, and VARGRAPH, (or VARCHAR(*MAX), VARUCS2(*MAX), or VARGRAPH(*MAX)).

  • Guest
    Reply
    |
    May 27, 2021

    @BrianRusch
    If you use VARCHAR then the variable will have the format of a RPG variable length character field.
    Using my suggestion using STRING it would be null terminated as known in C++ and Java.

  • Guest
    Reply
    |
    May 26, 2021

    My suggestion would be:

    dcl-s myText varchar(*MAX);

  • Guest
    Reply
    |
    May 26, 2021

    That works for me too.

  • Guest
    Reply
    |
    May 26, 2021

    Or how about

    dcl-s myText string;