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.
IBM believes that the request described has been solved and is available with new built-in functions %MAXARR and %MINARR. These built-in functions are available for 7.3 and 7.4 with PTFs.
For 7.3, you need PTF 5770WDS SI77165.
For 7.4, you need PTF 5770WDS SI77166.
For 7.4 TGTRLS(V7R3M0), you need PTF 5770WDS Si77167.
For more information, see https://www.ibm.com/support/pages/node/6481909.
The CAAC has reviewed this requirement and recommends that IBM view this as a medium priority requirement that should be addressed. It would be cleaner and easier to code, to name an array rather than the individual elements of it, in a min or max function. In addition, receiving the position of the min or max value might help in aligning that value with something in a different array, such as for an employee name array, for example.
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
Hi Vern. Yes, you could use the result of %maxarr as your array index. :-)
Barbara, could things be nested, as with other functions? So that one could use this statement -
maxval = arr(%maxarr(arr));
Hope this isn't a Captain Obvious kind of thing!
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 will most likely be in the form of %MAXARR and %MINARR built-in functions that return the index of an element with the maximum or minimum value in the array.
RPG built-in functions that can be used in expressions don't have parameters that get modified. If this extra parameter was not added you could code like this:
maxval = %maxarr(arr);
index = %lookup(maxval : arr);
But rather than have an extra parameter to receive the index, the built-in functions could just return the index instead of returning the maximum or minimum value.
index = %maxarr(arr);
maxval = arr(index);
It would be interesting to see some real-life suggestions of how RPG programmers would use these built-in functions. Would it be more usual to just want the value, or would it be more usual to want to know which element has that value?
Would it be useful to have another optional parameter to the bif to get the element of the array with the min or max value?
Such as an array {10, 20, 50, 10}, %maxarr would return 50, and this new parm would get 3. And %minarr would give 1, as that is the first element with the minimum value.
Would it be useful to have another optional parameter to the bif to get the element of the array with the min or max value?
Such as an array {10, 20, 50, 10}, %maxarr would return 50, and this new parm would get 3. And %minarr would give 1, as that is the first element with the minimum value.
IBM has received the requirement and is evaluating it. IBM will provide a response after evaluation is complete.
Hi Bob, I get your point, but it would be inconsistent with other built-in functions, like %SUBARR, that have start and length/number parameters. So, if these built-ins ever get implemented, you'll have to code that "1" for the starting_elem if you want to specify the number of elements.
Hi Barbara,
Yes %MinARR() could have 1, 2 or 3 parameters.
%MAXARR( myArr_or_DSArr [ : max_elems ]);
%MAXARR( myArr_or_DSArr : starting_elem : max_elems);
I suggest this because I'm always partially filling an array and have on only 1 occasion had an array where I started filling it at index X instead of 1. Of course I know "18 people" have code that starts from something other than 1, but I prefer to satisfy the overwhelming/vast majority with %MAXARR( arr : max_elems); and make the exception situations work for it. Thanks for the consideration.
To fully support arrays, including getting the maximum or minimum value of a subfield in a data structure array (the maximum or minimum of dsarray(*).subfield), the syntax would have to be quite different from the syntax %MAX and %MIN. So a different set of built-in functions, such as %MAXARR and %MINARR, would probably be used for arrays.