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



Tracy,

If you have the RPG ToolKit for OS/400 you can do it in two lines of
code.
If you don't you can get the FindReplace procedure, out of my article on
this topic at
http://www.mcpressonline.com/mc?1@46.DRG8acAs5B1.104752@.6ae52ffe

If you don't have the toolkit or the FindReplace procedure, you can
still do what you want in just 4 lines of code:

Here's some example D specs for the data...


     D input           S             30A   Inz('RABBIT PACK, 6PC. WINE
TOOLKIT')
     D nPos            S             10I 0


First get rid of the garbage and replace them with blanks.

     C     ',.':'  '     xlate     input         input

Now get rid of the duplicate blanks..
     C                   eval      input = FindReplace('  ':' ':Input)


In otherwords:

     C     ',.':'  '     xlate     input         input
     C                   eval      input = FindReplace('  ':' ':Input)



If you need to do it with raw RPG IV, its almost as easy.
Just replace the FindReplace line with the following:

     C                   eval      nPos = %scan('  ':Input:nPos)
     C                   dow       nPos > 0 
     C                   eval      input = %Replace(' ':Input:nPos:2)
     C                   eval      nPos = %scan('  ':Input:nPos)
     C                   enddo


Bob Cozzi


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.