420 pts.
 Replace ” with ” in AS/400 string
Hi i have a string and want to replace all occurance of " with ".Please let me know how can i accomplish this .

Software/Hardware used:
as400
ASKED: April 15, 2011  6:18 PM
UPDATED: May 2, 2011  11:16 PM

Answer Wiki:
If you can use embedded SQL in your RPG program, it becomes much easier than the built it RPG methods I've seen: exec sql 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  Koohiisan   5,005 pts.
All Answer Wiki Contributors:  Koohiisan   5,005 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

What is the string contained in — a program variable? …a column in a table?

What language do you want to use?

Tom

 110,135 pts.

 

If using RPG, you can use the BIF

%SCANRPL (scanfor : replacewith : targetstring) 
 3,115 pts.

 

Is that a 7.0 BIF, Graybeard52? Or did they sneak one (that I have been wanting) passed me?

 7,205 pts.

 

@Bigkat

Yep, looks like a 7.1 thing.

Here

 5,005 pts.