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



Of course, is you use the SQL REPLACE function, no loop needed - it changes all occurrences of the search pattern.

Something like exec sql
set :hostvar = replace(:hostvar, 'search', 'replace');

I think that would do it - manuals tell all!

Vern

On 10/2/2013 1:30 PM, TheBorg wrote:
Oops... correction to prevent endless looping, but I think you get the
drift...


D SRCDTA s 100A inz('COPY EQUIPMNT, EQIPX , , ')
D ScanFor s 30 Varying
D Length s 10I 0
D BeginningPos s 10I 0 inz(1)
D StartPos s 10I 0 inz(1)
D ReplaceWith s 100 Varying
D PosFound s 5i 0

/Free

ScanFor = ', ';
ReplaceWith = ',';
PosFound = %scan( ScanFor : SRCDTA : BeginningPos );

Dow PosFound > 0;

If (PosFound > 0); // If string was found.
SRCDTA = %replace( %trimr(ReplaceWith)
: SRCDTA
: PosFound
:%len(ScanFor)
);
EndIf;

StartPos = PosFound + 1;
PosFound = %scan( ScanFor : SRCDTA : StartPos );

Enddo;

*INLR = *on;
/End-Free




"Kari Zeglin" wrote in message
news:mailman.9464.1380734512.9013.rpg400-l@xxxxxxxxxxxx...



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.