Idea submitted: Built in function to subset an array using a procedure to filter

David Gibbs via RPG400-L <[email protected]>
Newsgroups gmane.comp.lang.as400.rpg
Message-ID <CAEStNXkLU=3ccM2GriafHgfmdy9okFcT3XVRLgMbfD8P3iU_Dg@mail.gmail.com>
So I submitted a enhancement request to the Ideas site to add a built in
function to subset an array using a procedure to determine if the array
element should be included.

https://ibm-power-systems.ideas.ibm.com/ideas/IBMI-I-4699

Create a new built in function to subset an array using a procedure to
filter.

Similar to the %SUBARR function, but allow a procedure to be specified to
determine if the array entry should be included in the result.

Something like ...

dcl-ds arraySpec_t qualified template;
  subField1 char(10);
  subField2 char(10);
end-ds;

dcl-ds newArray likeds(arraySpec_t);
dcl-ds oldArray likeds(arraySpec_t);
.
.
newArray = %FILTERARR(oldArray:1:%elem(oldArray):filterProc);
.
.
.
dcl-proc filterProc;
  dcl-pi *n ind;
    entry likeds(arraySpec_t) const;
  end-pi;
  return entry.subField1 = 'xyz';
end-proc;


Any comments on this?

david

-- 
IBM i on Power Systems: For when you can't afford to be out of business!

I'm riding in the American Diabetes Association's Tour de Cure to raise
money for diabetes research, education, advocacy, and awareness.  You can
make a tax-deductible donation to my ride by visiting
https://mideml.diabetessucks.net.

I may have diabetes, but diabetes doesn't have me!
-- 
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: [email protected]
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request-+hD5IHI5Xscn3HwCXmMcX9BPR1lH4CV8@public.gmane.org
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support-FMtJrHiV//lnDLsaKlm4mFaTQe2KTcn/@public.gmane.org for any subscription related questions.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.