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
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
[javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.