Usually to replace a text in a string you use the "inspect replacing" statement. But with this kind of approach the original text and the new text must have the same length.
To avoid this problem you can use the "C$REPLACE_ALL" routine.
This routine uses the regular expression syntax in both the search string and the replace string.
Here's the syntax for C$REPLACE_ALL:
call "C$REPLACE_ALL" using wrk-str search-string replace-string crep-right-trimmed w-error giving wstatusWhere:
move "Today is a rainy day" to wrk-str call "C$REPLACE-ALL" using wrk-str "rainy" "very sunny" crep-right-trimmed w-error giving wstatus
Article ID: 276
Created: June 29, 2016
Last Updated: December 21, 2022
Author: Support KB Author
Online URL: https://support.veryant.com/phpkb/article.php?id=276