×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
Both have Regular Expression capabilities. SQL its built in but relies on a java stack to complete and the functionality explains as complicated so cannot be optimized. Regular Expressions in RPG take a bit more work to code but run faster.
Regular Expressions allow for mono-casing the search and compare strings.
Not using Regular Expressions, I would make certain that the data is in varying length strings. If the data is in a database and is not a varying string column you need to convert to a varying length, which is expensive enough depending on the length of the string. Searching varying length is always better since the search tools in both can use then built in length value to know how many characters to look at. If you are using varying lengths always trim off trailing blanks, seems obvious but I have run into code that loads a varying length field with a full value including trailing blanks.
If you attempt to test using debug then SQL will always be slower as SQL injects many messages into the job log when debug is active.
Wrap your test code with a timestamp capture before and after then do a %DIFF() function.
-Matt
-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of Chris Holko
Sent: Wednesday, May 15, 2019 8:29 AM
To: RPG400-L@xxxxxxxxxxxxxxxxxx
Subject: Which is faster at string manipulation and searching? RPG or SQL
So with regards to searching a long string, which would be a quicker solution overall.
embedded SQL to upper case and search for a substring or upper case via plate and then substring in RPG?
If unknown, what would be the best method to test?
Chris
--
This is the RPG programming on IBM i (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.midrange.com_mailman_listinfo_rpg400-2Dl&d=DwICAg&c=2S-2xx8Cum_thMfWs-kOOHQTwolPvSZ4PFLhr1wDDGs&r=wgq2KO1Tl8HswJht2RKpmz7qvL2YDU_M-VhnRH6r43I&m=ubOIAHeF3ckYBIoQCbqbbBU1vc_dzRIMQGQJoPEWyYY&s=Z-M3VDK3fSnqcvVYVuPPE2-_oK_BPCKpOoE2rGFvpgM&e=
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://urldefense.proofpoint.com/v2/url?u=https-3A__archive.midrange.com_rpg400-2Dl&d=DwICAg&c=2S-2xx8Cum_thMfWs-kOOHQTwolPvSZ4PFLhr1wDDGs&r=wgq2KO1Tl8HswJht2RKpmz7qvL2YDU_M-VhnRH6r43I&m=ubOIAHeF3ckYBIoQCbqbbBU1vc_dzRIMQGQJoPEWyYY&s=E7B2VYebGuxomtetff0Hgmk2YCW9oMaczHhpQgUOGXI&e= .
Please contact support@xxxxxxxxxxxx for any subscription related questions.
Help support midrange.com by shopping at amazon.com with our affiliate link:
https://urldefense.proofpoint.com/v2/url?u=https-3A__amazon.midrange.com&d=DwICAg&c=2S-2xx8Cum_thMfWs-kOOHQTwolPvSZ4PFLhr1wDDGs&r=wgq2KO1Tl8HswJht2RKpmz7qvL2YDU_M-VhnRH6r43I&m=ubOIAHeF3ckYBIoQCbqbbBU1vc_dzRIMQGQJoPEWyYY&s=bG-2ttZrobmPGv_a7duSdy8f9d3si2t6qK46icoXPUU&e=
As an Amazon Associate we earn from qualifying purchases.