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 Submitted
Workspace IBM i
Categories Languages - RPG
Created by Guest
Created on Feb 27, 2024

RPG Language Feature - Variable Triggers - Computed Properties

Languages like Apple's Swift, Java, Python, C# have this fantastic feature called "Computed Properties".

Think of them as "variable triggers".

If new phrasing can be added to RPG's Dcl-S when defining a work variable, that would specify logic to be run when that variable is read (GET), or changed (SET).

If this were possible in RPG, I'd use it very often, and I think other developers would too. So if a sub-proc could be attached to a Dcl-S work variable, up to two sub-procs; one for SET and another for GET, would be evoked automatically when said variable is read or updated.

Idea priority High
  • Guest
    Reply
    |
    Mar 15, 2024

    I don't see this as necessary, since we can pretty much already do it (If I'm understanding the idea correctly).

    Consider:

    dcl-s Var_t  char(10) template;
    dcl-s MyVar1 like(Var_T);
    dcl-s MyVar2 like(Var_T);
    dcl-s MyVar3 like(Var_T);
    dcl-s Code like(Var_T);

    dcl-proc ComputeMyVar;
    dcl-pi *n like(Var_t);
    Var like(Var_t);
    NewValue like(Var_t) const options(*nopass);
    end-pi;
    if %passed(NewValue); // New Value for MyVar passed - this is a SET
    // Do SET Logic (old value)
    Var = NewValue;
    // Do SET Logic (new value)
    else; // New Value NOT passed - this is a GET
    // Do GET Logic
    endif;

    return Var;
    end-proc;

    // Then, you can simply:
    ComputeMyVar(MyVar1: 'CODE1');
    ComputeMyVar(MyVar2: 'CODE2');

    Code = ComputeMyVar(MyVar3);

    etc...


    You can code an optional third parm for any additional information, eg an indicator to tell the procedure you want to CLEAR or RESET the variable, etc.

    Seems like this is powerful enough without the complications of creating new syntax for "variable triggers".
  • Admin
    Maria del Carmen Ruvalcaba Cevallos
    Reply
    |
    Mar 12, 2024

    The CAAC has reviewed this IBM Idea and recommends that IBM view this as a medium priority Idea that should be addressed.

    Interesting language modernization idea, might be nice to have. The feature is somewhat obscure even in modern 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 IBM Ideas on the broader IBM i community and has therefore reviewed your Idea.

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

    Carmelita Ruvalcaba- CAAC Program Manager