× 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.



If this response document is yours then you might just build the template with the escaping already built in. If this response document is not yours and is on the IFS at some point, SED can be very helpful. %SCANRPL() can also take the max size of the source string to scan so try feeding in the length of the data (if the variable is not a varying string).

-Matt

-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of Mohammad Tanveer
Sent: Monday, May 6, 2019 11:47 AM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: %SCANRPL to escape characters

responsemsglog = %scanrpl('\':'\\"':responsemsg_data);
responsemsglog = %scanrpl('"':'\"':responsemsglog);

responsemsglog has json .. maximum size of it is 4K bytes and may look like this..for example .. every " and \ needs to be escaped.

REQUEST BODY: requestBody=[[ { "form": "freightReport", "routeInfo": {
"email": { "sendTo": "javatestmail@xxxxxxx", "from": "MARK BERKOWITZ" } },
"callingSystem": "US", "language": "English", "locale": "en_US",
"currency": "USD", "vendorNumber": "123456", "carrier": "DC Logistics",
"programName": "EXMADCXX0", "programBatchName": "FRT004E", "sortCode": "S",
"stateShippedFrom": "CALIFORNIA", "invoiceSentBy": "", "printDate":
"10/25/2018", "printTime": "04:00:06", "flagShowAddress": true,
"flagNoLineItems": false, "flagShowUpdateLabel": true, "providedTo": {
"shipViaCode": "LK", "contactName": "TX Logistics", "attention": "Micky M"
}, "messages": [ "Messages One", "Message Two" ], "shipmentList": {
"totalShipments": "1", "shipments": [ { "shipmentNumber": "1", "lineItems":
[ { "shipDate": "10/31/2018", "shipVia": "HL", "warehouseCode": "I6",
"zip": "49442", "zip4": "5396", "customerNumber": "1522814",
"customerName": "GEERPRES", "addr1": "1780 HARVEY ST", "city": "MUSKEGAN",
"state": "MI", "totalLbs": "276", "totalSkids": "1", "totalPieces": "0",
"proNumber": "1071590221", "routingCode": "GR", "subTotal": "",
"subTotalLbs": "", "subTotalSkids": "", "subTotalPieces": "" } ] }, {
"shipmentNumber": "2", "lineItems": [ { "shipDate": "10/31/2018",
"shipVia": "HL", "warehouseCode": "I6", "zip": "49442",]


On Mon, May 6, 2019 at 12:37 PM Jon Paris <jon.paris@xxxxxxxxxxxxxx> wrote:

Wanna show us the actual code and definitions you are using? I can
think of a couple fo things that might cause performance issues but
don't want to just guess.


Jon Paris

www.partner400.com
www.SystemiDeveloper.com

On May 6, 2019, at 1:21 PM, Mohammad Tanveer <surgum@xxxxxxxxx> wrote:

Is there a better way to escape certain characters in a 4000 byte
character
string? It appears %SCANRPL is taking CPU resources; which
performance manger is not happy about.

I am using it to replace " with \" and \ with \\ ... I have to use
this function for each character I want to escape. This code might
execute
60,000 times in 15/20 mins ... during heavy transaction load.

Regards
--
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-kOOHQTw
olPvSZ4PFLhr1wDDGs&r=wgq2KO1Tl8HswJht2RKpmz7qvL2YDU_M-VhnRH6r43I&m=s
-dZI7tEr_0aeDtuOuXBMa3jeVQNbaOB8_i9SqUEKhk&s=Iv5Z3QehXSUk6Rc9YUy2pwN
CVOGpyYDgWIxXkV9BmGU&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=s-dZI7tEr_0aeDtuOuXBMa3jeVQNbaOB8_i9SqUEKhk&s=vKrydpcemCkmyIQmlBe6qiJmjYnvxiJnSGBGzH2AdSU&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.c
om&d=DwICAg&c=2S-2xx8Cum_thMfWs-kOOHQTwolPvSZ4PFLhr1wDDGs&r=wgq2KO1Tl8
HswJht2RKpmz7qvL2YDU_M-VhnRH6r43I&m=s-dZI7tEr_0aeDtuOuXBMa3jeVQNbaOB8_
i9SqUEKhk&s=IqxWOx6K7jPR-Q9mk4Y3FEtdlcNkCgLHILdcfCpscfk&e=

--
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.co
m_mailman_listinfo_rpg400-2Dl&d=DwICAg&c=2S-2xx8Cum_thMfWs-kOOHQTwolPv
SZ4PFLhr1wDDGs&r=wgq2KO1Tl8HswJht2RKpmz7qvL2YDU_M-VhnRH6r43I&m=s-dZI7t
Er_0aeDtuOuXBMa3jeVQNbaOB8_i9SqUEKhk&s=Iv5Z3QehXSUk6Rc9YUy2pwNCVOGpyYD
gWIxXkV9BmGU&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=s-dZI7tEr_0aeDtuOuXBMa3jeVQNbaOB8_i9SqUEKhk&s=vKrydpcemCkmyIQmlBe6qiJmjYnvxiJnSGBGzH2AdSU&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.c
om&d=DwICAg&c=2S-2xx8Cum_thMfWs-kOOHQTwolPvSZ4PFLhr1wDDGs&r=wgq2KO1Tl8
HswJht2RKpmz7qvL2YDU_M-VhnRH6r43I&m=s-dZI7tEr_0aeDtuOuXBMa3jeVQNbaOB8_
i9SqUEKhk&s=IqxWOx6K7jPR-Q9mk4Y3FEtdlcNkCgLHILdcfCpscfk&e=

--
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=s-dZI7tEr_0aeDtuOuXBMa3jeVQNbaOB8_i9SqUEKhk&s=Iv5Z3QehXSUk6Rc9YUy2pwNCVOGpyYDgWIxXkV9BmGU&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=s-dZI7tEr_0aeDtuOuXBMa3jeVQNbaOB8_i9SqUEKhk&s=vKrydpcemCkmyIQmlBe6qiJmjYnvxiJnSGBGzH2AdSU&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=s-dZI7tEr_0aeDtuOuXBMa3jeVQNbaOB8_i9SqUEKhk&s=IqxWOx6K7jPR-Q9mk4Y3FEtdlcNkCgLHILdcfCpscfk&e=

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 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.