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).
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:
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 an idea.
Get feedback from the IBM team and other customers to refine your idea.
Follow the idea through the IBM Ideas process.
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.
An operand is now allowed for the SELECT statement, and two new operation codes, WHEN-IN and WHEN-IS, are added for comparison with the SELECT operand.
For documentation on this enhancement, see
- What's new since 7.5: https://www.ibm.com/docs/en/ssw_ibm_i_75/rzasl/rpgrelv7r5post.htm
- What's new since 7.4: https://www.ibm.com/docs/en/ssw_ibm_i_74/rzasl/rpgrelv7r4post.htm
For information about the PTFs you need for this enhancement, see https://www.ibm.com/support/pages/node/6982199
- IBM Power Systems Development
I think it is extremely important, to make the select statement more useful, that the evalutation of the "left side" expression is only done once, so code like this will work:
select
precedureCall(parameter)
;
So the procedure is only called once, and the resulting value can be compared to different cases.when *zero;
// OK
when in %range(1:9);
// low error
when in %list(10:11:12);
// medium error
when in %range(*loval:-1);
// negativ error
other;
// something else
endsl;
At best, %range and %list should be supported, because this makes code much clearer - even if it differs from SQL syntax.
You can go even beyond pure C-styled switch statements.
Also string matching (matching directly to a string).
Or full pattern matching with guards and even destructuring (ie. matching on a full DS), inspired by language like Haskell or Scala (this would be nice).
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.
The CAAC has reviewed this requirement and recommends that IBM view this as a medium priority requirement that should be addressed. This would create consistency with the way SQL handles the CASE predicate.
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
For more details about CAAC's role with RFEs, see http://www.ibmsystemsmag.com/Blogs/i-Can/May-2017/COMMON-Americas-Advisory-Council-%28CAAC%29-and-RFEs/
Nancy Uthke-Schmucki - CAAC Program Manager
The COMMON Europe Advisory Council (CEAC) has reviewed this requirement and recommends that IBM view this as a medium priority requirement that should be addressed.
Background: The 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
Why not make it a SWITCH opcode after all? Especially valuable would be that the expression in the SELECT/SWITCH statement can also be a function (return value).
IBM has received the requirement and is evaluating it. IBM will provide a response after evaluation is complete.
If this is implemented, it will almost certainly be an overload of the SELECT operation code. If the SELECT opcode has an operand, the WHEN opcode will have a single operand rather than a logical expression.
I first saw the CASE statement in Pascal, and would find it quite useful in RPG. It more clearly conveys the "parallel" nature of the tests (while the SELECT statement's WHEN clauses might contain wildly different conditions).
The standard SQL procedure language and Db2 support a CASE statement the provides the same capability. For example:
CASE v_workdept
WHEN 'A00' THEN UPDATE department SET deptname = 'DATA ACCESS 1';
WHEN 'B01' THEN UPDATE department SET deptname = 'DATA ACCESS 2';
ELSE UPDATE department SET deptname = 'DATA ACCESS 3';
END CASE
Yes - just like PL/1 :)
I've wanted this for a long time and actually tend to use SELECT only in these kinds of cases. I'm not sure though that overloading SELECT like this is the best approach. As the requestor notes SWITCH is used in other languages and I'd rather see a new op-code implemented for RPG.
I've wanted this for a long time and actually tend to use SELECT only in these kinds of cases. I'm not sure though that overloading SELECT like this is the best approach. As the requestor notes SWITCH is used in other languages and I'd rather see a new op-code implemented for RPG.