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, 2018

Possibility to specify a compare procedure for SORTA and %LOOKUPxx

I would like to have the possibility to specify a compare procedure for SORTA and %LOOKUPxx in the way we are doing with the qsort and bsearch
It would make both instructions much more flexible. The pointer to the compare procedure should be added as a new optional parameter.

The compare procedure should have the same syntax as when used with qsort, returning 1 for greater than; -1 for less than; 0 for equal.


Use Case:

%LOOKUP(arg : array : start_index : number_of_elements : %paddr(Compare) )

array ds likeds(arg) dim(10)
*++++++++++++++++++++++++++++++++++++++++++++++++++++
* Compare Two Elements
*++++++++++++++++++++++++++++++++++++++++++++++++++++
P Compare B
D Compare PI 10I 0
D elem1 likeds(arg)
D elem2 likeds(arg)
D*
select;
when elem1.fld1 > elem2.fld1;
return 1;

when elem1.fld1 < elem2.fld1;
return -1;

when elem1.fld2 > elem2.fld2;
return 1;

when elem1.fld2 < elem2.fld2;
return -1;

other;
return 0;
endsl;

P E


Idea priority Medium
  • Guest
    Reply
    |
    Nov 29, 2022

    The CAAC has reviewed this IBM Idea and recommends that IBM not implement this request. These operations are not widely used and therefore not worth the investment.


    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


    Nancy Uthke-Schmucki - CAAC Program Manager

  • Guest
    Reply
    |
    Apr 17, 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.

  • Guest
    Reply
    |
    Apr 4, 2018

    I'm not the OP, but ...

    One benefit would be the removal of the (albeit slight) confusion over what the two size_t parameters mean. Another possible source of confusion for qsort() and bsearch() is for non-contiguous arrays, not getting the stride between the elements correct.

    Another possible benefit might be that RPG could allow the compare procedure to have a optional communication-area parameter. On a couple of occasions using qsort() and bsearch(), I have had to decide between using a global variable to tell the compare procedure to act in one way or another, or defining two or more separate compare procedures. Being able to pass an extra parameter to the compare procedure would be handy.

  • Guest
    Reply
    |
    Apr 4, 2018

    I'm having trouble understanding what benefit this offers over qsort() and bsearch() - perhaps the OP can elaborate?

  • Guest
    Reply
    |
    Feb 16, 2018

    IBM has received the requirement and is evaluating it. IBM will provide a response after evaluation is complete.

3 MERGED

SORT allow callback and ascending/descending multi fields for datastructure

Merged
Multi field sorting was delivered with: https://ibm-power-systems.ideas.ibm.com/ideas/IBMI-I-2197 But this feature seems half-implemented because it doesn't allow ASC/DESC.... Please give the possibility to specify *ASCENDING and *DESCENDING when ...
over 2 years ago in IBM i / Languages - RPG 1 Future consideration