If you can use embedded SQL in your RPG program, it becomes much easier than the built it RPG methods I've seen:
set :originalvar = replace(:originalvar,' with ','itke');
That should replace all occurrences of ' with ' with 'itke'.
It's a similar idea to the answer given <a href="http://itknowledgeexchange.techtarget.com/itanswers/using-as400-sql-to-replace-a-variable-string/">here</a>, but substituting host variables for fields.
There is a limit on when the SQL set command became available, and I don't see a mention of what release you are on...so...YMMV. :)
Last Wiki Answer Submitted: April 15, 2011 8:57 pm by Koohiisan5,005 pts.