Skip to Main Content
IBM Power Ideas Portal

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:

Post your ideas

Start by posting ideas and requests to this portal to enhance a Power product or service. Take a look at ideas others have posted and upvote them if they matter to you,

  1. Post an idea

  2. Upvote ideas and add comments to ideas that matter most to you

  3. Get feedback from the IBM team to refine your idea

Help IBM prioritize your ideas and requests

The IBM team may need your help to refine the ideas so they may ask for more information or feedback. The Power teams will then decide if they can begin working on your idea. If they can start during the next development cycle, they will put the idea on the priority list. Each team at IBM works on a different schedule, where some ideas can be implemented right away, others may be placed on a different schedule.

Receive notification on the decision

Some ideas can be implemented at IBM, while others may not fit within the development plans for the product. In either case, the team will let you know as soon as possible. In some cases, we may be able to find alternatives for ideas which cannot be implemented in a reasonable time.


Specific link you will want to bookmark for future use

IBM Unified Ideas Portal - https://ideas.ibm.com/ - Use this site to create or search for existing Ideas across all IBM products that are outside of Power, and track all of your personal interactions with all Ideas.

Status Not under consideration
Workspace IBM i
Categories Languages - RPG
Created by Guest
Created on Oct 20, 2021

String interpolation for RPG

Add string interpolation support so variables can be inserted into string literals without having to use concatenation with + symbols and multiple literals.

For example:
apples = 4
bananas = 3
print(f"I have {apples} apples and {bananas} bananas")


Use Case:

This would be a boon to programmers, increasing speed and reducing errors. Combining literals and variables is an extremely common task.


Idea priority Medium
  • Guest
    Nov 18, 2021

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

    While we agree with the request, we do not plan to implement it at this time. Here are two of the reasons that the RFE is being closed at this time:

    - This kind of string interpolation would be limited to literals, since RPG would need to know at compile-time what field values were needed.

    - The suggestion made in the comments to use DATA-GEN might prove useful, even though the syntax is not as convenient, and even though it requires all the required fields to be coded in a single data structure.

  • Guest
    Oct 27, 2021

    That's an elegant way of using DATA-GEN.
    Thanks for sharing

  • Guest
    Oct 26, 2021

    Here is a support document with the same content that I posted in the blog article.
    https://www.ibm.com/support/pages/node/6508862

  • Guest
    Oct 26, 2021

    Sorry about that Peder. I didn't realize it was restricted. Perhaps it's restricted to members of the RPG community. I will add a similar document to Support and post the link here.

  • Guest
    Oct 26, 2021

    @Barbara Morris: I get the message "You do not have permission to view this blog post" when trying to see what you have written.

  • Guest
    Oct 25, 2021

    I wrote a blog about how you can use DATA-GEN for this:
    https://community.ibm.com/community/user/power/blogs/barbara-morris/2021/10/25/use-data-gen-for-string-interpolation

  • Guest
    Oct 21, 2021

    This is a duplicate of:

    http://www.ibm.com/developerworks/rfe/execute?use_case=viewRfe&CR_ID=118923

    The original RFE had more details and are more precise, however was declined. This current RFE will reopen the case.

  • Guest
    Oct 21, 2021

    While there have been a number of significant enhancements dealing with string functions over the years, we're still missing the capstone feature of a simple (a.k.a. intuitive) and efficient "string interpolation" technique. I've done my share of "bare metal" string coding with lookup's and MOVEA's; modern string management opcodes have greatly simplified my developed and enabled better applications.

    I'd use such a feature when building dynamic SQL, error messages, printed forms (letters), and display file output/input. It would greatly simplify my code generation utilities as well.

    Some RFE's are relatively narrow in their focus and application. If implemented, this candidate will be widely accepted and used.

  • Guest
    Oct 21, 2021

    You can use the C-functions like sprintf (and wrap it in an easy to use procedure) in RPG to get similar results.

    Another option is...

    apples = 4;
    bananas = 3;
    s = "I have {apples} apples and {bananas} bananas";
    s = %ScanRpl('{apples}': %Char(apples): s);
    s = %ScanRpl('{bananas}': %Char(bananas): s);

  • Guest
    Oct 20, 2021

    I think that it would be useful to have it accept function calls, BIFs, etc. as well as simple variable names as the replacement values. That way you could format numerics any way you want without having to create temporary character variables.