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 Oct 13, 2020

Add an enumeration type to RPG so that named constants can be qualified

Allow the use of the CONST keyword to define a datastructure as a constant


Use Case:

There is currently no mechanism for a complex type to be declared as a constant, immutable value.

Providing this would also allow a qualified datastructure to be used as a namespace for the definition of constants. Whilst this could be done with long constant names and coding standards, this would be a more readable and self documenting approach.

Used in combination with LikeDS it would allow the creation of what would effectively be enumerated types.


Idea priority Low
  • Guest
    Reply
    |
    Nov 17, 2023
    IBM believes that the solution for the Idea described is available for 7.4 and 7.5 with the following PTFs for new "enumeration" definition-type.

    7.4:
    ILE RPG compiler: 5770WDS SI84886

    7.5:
    ILE RPG compiler: 5770WDS SI85009
    ILE RPG compiler, TGTRLS(V7R4M0): 5770WDS SI85043

    An enumeration can be qualified:
    DCL-ENUM sizes QUALIFIED;
    small 1;
    medium 2;
    large 3;
    END-ENUM;
    DCL-S size INT(10);
    size = sizes.medium; // Use the qualified enum item

    An enumeration can be unqualified:
    DCL-ENUM truefalse;
    true '1';
    false '0';
    END-ENUM;
    DCL-S isValid ind;
    isValid = true; // Use the unqualified enum item

    You can also use enumerations as arrays. For more information, see https://www.ibm.com/support/pages/node/7047175.

    - IBM Power Systems Development
  • Guest
    Reply
    |
    Sep 26, 2023

    Please combine that with the ability to use those enums as conditions in COBOL Level 88 manner!

  • Guest
    Reply
    |
    Sep 28, 2021

    The CAAC has reviewed this requirement and recommends that IBM view this as a medium priority requirement that should be addressed. This would help RPG become more "normal" -- this is a useful extension to RPG that is found in other languages.

    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
    |
    May 27, 2021

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

    Specifically, the headline has been updated, per earlier Comments in this RFE.

    Previous Headline: Allow CONST keyword for data structures
    New Headline: Add an enumeration type to RPG so that named constants can be qualified

  • Guest
    Reply
    |
    Dec 10, 2020

    Hello Stuart. I believe this RFE would attract more votes if the title was about "enum" rather than about a CONST keyword for data structures.

    Do we have your permission to change the title to the following:
    "Add an enumeration type to RPG so that named constants can be qualified"

    Or, feel free to suggest a different new title in your response :-)

    - Barbara Morris

  • Guest
    Reply
    |
    Nov 25, 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.

    If this request is implemented, it would be in the form of an "enumeration" definition, as indicated in the comments for this RFE.

  • Guest
    Reply
    |
    Oct 15, 2020

    Jon, it is already possible to use LIKE with a template data structure subfield.

    dcl-ds ds_t template qualified;
    subf char(10);
    end-ds;
    dcl-s x like(ds_t.subf);

  • Guest
    Reply
    |
    Oct 15, 2020

    Yes, a genuine enum would be even better. Maybe I should have been greedier in the first place :)

  • Guest
    Reply
    |
    Oct 14, 2020

    Would a real enumeration type fulfill this requirement in a more direct way? If not, please give an example of how you would use LIKEDS with a CONST data structure.

    Here is a suggestion for what an "enum" might look like for RPG.

    // An enum that is really just a list of named constants
    dcl-enum *n;
    blue 'BLUE';
    red 'RED';
    yellow 'YELLOW';
    end-enum;
    paint = red;

    // An enum that is basically a qualified named constant
    dcl-enum categories qualified;
    open 'OPEN';
    closed 'CLOSED';
    end-enum;
    category = categories.open;

    // A typed enum that can be used with LIKE
    dcl-enum customer_type int(10);
    ordinary 1;
    special 2;
    inactive 3 dft; // this is the default
    end-enum;
    dcl-s custType like(customerType); // initialized with 3 (the default)

    // A qualified typed enum that can be used with LIKE
    dcl-enum order_type char(10) qualified;
    standard 'Std' dft; // this is the default
    discount 'Discount';
    end-enum;
    dcl-s orderType like(orderType); // initialized with 'Std' (the default)

  • Guest
    Reply
    |
    Oct 14, 2020

    I think you could probably get most of what you want if IBM relaxed the rules such that a Template DS subfield could be used in a Like definition.

    What features do you need that this would not fulfill?

  • Guest
    Reply
    |
    Oct 14, 2020

    That might be an interesting RFE. May you please share a coding example to give us better insight of it?