Re: Idea submitted: Built in function to subset an array using a procedure to filter
Mark Waterbury via RPG400-L <[email protected]>
| Newsgroups | gmane.comp.lang.as400.rpg |
|---|---|
| Message-ID | <[email protected]> |
David, You might also consider creating a temporary table in Db2, and then load the entire array into the temp table, and then you can use the full power of SQL to query the temp table, and create a "results set" containing only the subset that you are interested in. And, when done, you can just DROP the temp table. I think this should be much easier and more straight-forward than your proposed "enhancement" to RPG IV. All the best, Mark S. Waterbury On Tuesday, November 4, 2025 at 01:36:03 PM EST, David Gibbs via RPG400-L <[email protected]> wrote: 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: [email protected] Before posting, please take a moment to review the archives at https://archive.midrange.com/rpg400-l. Please contact [email protected] for any subscription related questions. -- 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: [email protected] Before posting, please take a moment to review the archives at https://archive.midrange.com/rpg400-l. Please contact [email protected] for any subscription related questions.