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



Hi, Mark,
Soundex is really designed to work on a "word" basis, not an entire phrase.
So, you should parse out each word in a string, ignoring the short ones like "a", "an", "the" etc., and then feed each word to Soundex to get its "code"...
Then you can search for phrases that contain something that sounds like "x".
Hope that helps ...
All the best,

Mark S. Waterbury

On Thursday, September 24, 2020, 12:42:45 PM EDT, mlazarus <mlazarus@xxxxxxxxxxxx> wrote:

Brad,

  It can be very useful.  Just be aware that due to its short return
length (the first character of the word plus 3 "soundex return
characters"), it's mostly useful for shorter character strings.  You
might be able to get better results by breaking a longer string into
smaller chunks and doing a soundex over each of them, but I haven't
played with that.

  -mark

On 9/24/2020 9:40 AM, Brad Stone wrote:
soundex is so cool... :)  I just tried it on my customer database.



On Thu, Sep 24, 2020 at 8:36 AM Rob Berendt<rob@xxxxxxxxx>  wrote:

   
I believe the other two responders probably have something there.
The logic looks like someone who loves fixed format and only uses free
format if they absolutely have to.  Such as certain functions not available
in fixed format.

I have a tough time understanding a read loop of the customer master file
based on the customer key, which I assume is the customer number.  Is it
likely you have duplicate customer numbers?  Or would a chain have worked
better?

Then the big picture view has me wondering if you are looking for all
customers who may have a substring in their name.  Perhaps a customer
lookup function?  In that case I might use SQL and a cursor:
D Stmt1          s            512a  varying
D SearchString    s            50a  varying
Stmt1 = 'select cusnbr, cmname from cusmst where cmname like ?';
// The 'like' function, with a string surrounded by % signs, is your
midstring search
SearchString = '%' + %trim(neword) + '%';
Exec sql declare C1 cursor for SqlStmt;
Exec sql prepare SqlStmt from Stmt1;
Exec sql Open C1 using SearchString;
Exec sql fetch c1 into :cusnbr, :cmname; // Priming read of loop
Dow sqlcode = *zeros;
    // logic here to fill subfile of results
    Exec sql fetch c1 into :cusnbr, :cmname; // get next row
EndDo; // found all matching rows.
Exec sql close C1;


And if you want to get fancy you can even do a "sounds like".  For more
information see the following:

https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_74/db2/rbafzscasound.htm

Rob Berendt
--
IBM Certified System Administrator - IBM i 6.1
Group Dekko
Dept 1600
Mail to:  7310 Innovation Blvd, Suite 104
            Ft. Wayne, IN 46818
Ship to:  7310 Innovation Blvd, Dock 9C
            Ft. Wayne, IN 46818
http://www.dekko.com


-----Original Message-----
From: MIDRANGE-L<midrange-l-bounces@xxxxxxxxxxxxxxxxxx>  On Behalf Of
Danner, Duane
Sent: Wednesday, September 23, 2020 7:00 PM
To: midrange-l@xxxxxxxxxxxxxxxxxx
Subject: Have an issue with %trim

CAUTION: This email originated from outside of the organization. Do not
click links or open attachments unless you recognize the sender and know
the content is safe.


I have a input field called NAME and this field can be up to 30
characters.  I want to get rid of preceding blanks and post blanks.  If the
name BROTHERS is entered I only want 'BROTHERS'  not 'BROTHERS
          '

Then I want to scan a field name in a field CMNAME for 'BROTHERS'  in a
value that could be 'JONES BROTHERS                  '

C    *IN54        DOWEQ    '0'
C    CUSKEY        READE    CUSMST                                54
  *
C    *IN54        IFEQ      '0'

C                  MOVE      *BLANKS      NEWORD1
C                  EVAL      NEWORD1 = %Trim(NEWORD)

      /FREE

      pos = %scan (NEWORD1 : CMNAME);
      substring=%subst (CMNAME:1:pos);
      DSPLY  substring;

      /END-FREE
C    POS          IFNE      0
C                  WRITE    ITM
C                  ENDIF
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com

     

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.