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 Jan 19, 2023
Merged idea
This idea has been merged into another idea. To comment or vote on this idea, please visit IBMI-I-1417 RPG - Conditional (Ternary) Operator (?:) in EVAL operation.

Short hand IF-Else statements Merged

Coding is all about if statements and most of the times we code a simple "If this then that, else this " logic. 

It would be nice with a short hand format to this to ease the coding experience somewhat. The goal would be to have a quick, short (one line) way of assigning a value to a variable with a logical condition. I know there are different ways to solve this today with IF statements or SELECT statements. And they are great, especially when you have many different cases/options/conditions.  But a lot of times there is just an assignment with a simple "if this then that, else this" logic. 

Would clean up code a little and also mimic what can be done in other languages.

How to do this today: 
If NbrOfRows > 1;
  multiRowProcessing = 'Y';
else;
  multiRowProcessing = 'N';
endif;

How it could be solved with a new %BIF  as an example.    Possible BIF names: %IF,  %IFELSE  or something similar
multiRowProcessing  = %IFELSE (NbrOfRows > 1  : 'Y' : 'N' );     //    %BIF (Expression to evaluate : value if true : value if false )

How it could be solved with existing or similar opcode logic (Similar to SQL case)
multiRowProcessing   = CASE (NbrOfRows > 1 ) THEN  'Y' ELSE 'N'  END ;   

 

Idea priority Low
  • Guest
    Reply
    |
    Jan 19, 2023

    Your request is a duplicate of IBM Idea IBMI-I-1417 ("RPG - Conditional (Ternary) Operator (?:) in EVAL operation"). https://ibm-power-systems.ideas.ibm.com/ideas/IBMI-I-1417

    Please use that Idea to cast a vote or add a comment.

    One of the comments for that Idea has a response from IBM that suggests that new built-in function %IF would be added to fulfill that requirement. The comment says "If IBM provides this feature, it would most likely be in the form of a %IF built-in function rather than using the ? : syntax. %IF(condition : true value : false value)"

    - IBM Power Systems Development