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



As in the case of replacing one string with a longer one - you have to accommodate having several of the search string - so you can't pull in data to the full extent of the variable, because of potential overflow. So to replace 1 character with 3, and to guarantee no overflow, you read 1/3 of the length, I think. That's extreme and probably never going to happen in the real world - you at least have the 2 characters of the element closure between them - this is too messy to deal with - someone else can work the calculations, thank you very much!!!

So we are back to - use sed!!! Just learn how to manage regular expressions.

Vern

CRPence wrote:
Vern Hamberg wrote:
<<SNIP>>

If you CAN deal with a full variable and writing it back out to a
different stream file, I like using the SQL replace function -
that replaces all instances of the search string with the
replacement value - very cool. Just use a SET statement.

RPG's replace() can do the job, so long as you do it in a loop
that uses somewhere around the last found position as the start
from value in a loop. SQL is so much easier!!


Of course each implementation will have potential difficulties. Just be sure to [know how to] deal with the potential or actual truncation [sqlwarn ??] issue due to expansion of the data in a column or variable. :-)

Regards, Chuck

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.