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



sysdummy1 was often used prior to use of the SET variable statement. Since 
I've started using that I've not had an occasion to use a dummy file.
http://publib.boulder.ibm.com/infocenter/iseries/v5r3/ic2924/info/db2/rbafzmstsetinto.htm#setinto

Maybe, since it is just used by programmers, they should know the rules 
and key accordingly.  Perhaps a second field on the screen might be an 
optional escape character.

Rob Berendt
-- 
Group Dekko Services, LLC
Dept 01.073
PO Box 2000
Dock 108
6928N 400E
Kendallville, IN 46755
http://www.dekko.com





"Dan Bale" <dbale@xxxxxxxxxxxxx> 
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
10/06/2004 08:53 AM
Please respond to
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>


To
"RPG programming on the AS400 / iSeries" <rpg400-l@xxxxxxxxxxxx>
cc

Fax to

Subject
RE: multiple search arguments in one scan?






Thanks to all who have offered suggestions!

>      c/exec sql
>      c+ select '1'
>      c+   into :success_val
>      c+   from sysibm/sysdummy1
>      c+  where :value like '%&%'
>      c+     or :value like '%+%%'
>      c+     or :value like '%*%'
>      c+     or :value like '%+_%'
>      c+     or :value like '%?%'
>      c/end-exec

Interesting.  I've never seen SQL used like this.  What is the purpose of
sysibm/sysdummy1?  Does SQL require a file to "query" even if it's not
querying it?  Anyway, I can't see where this particular example would 
offer
a performance benefit over pure RPG, but I could be ignorant on this part.
At the very least, it could be confusing for someone else who has to 
modify
the application later on.

Maybe I should back up a bit and explain what's behind my original post.

I am allowing the user to search with wildcards.  The data in the search
argument itself may contain any typeable character, including the '%' and
'_'  characters that SQL uses to represent replacement characters.  I am
letting the user use the more familiar '*' and '?' conventions, and
converting them in my program to '%' and '_', respectively.

Because of all this, I need to use the ESCAPE expression as well.

Potential problems that I haven't figured out how to deal with:

Since one of the fields that can be searched is a wide-open text field 
that
allows any typeable characters, how do I allow the user to scan for the
occurrence of a '?' or '*'?  Maybe I just don't allow it?  Typically, 
these
wouldn't be searched for anyways, but I'm just trying to allow for maximum
flexibility within the reasonable confines of SQL.  One thing I am doing 
is
that I give the user the option to modify the SQL statement my program
generates from the prompted information, so if they feel "powerful" 
enough.
(Just so no one panics, the only users of this application are 
programmers.)

So, for example, a user may want to search for 'ABC_XYZ*', which is to say
that they are looking for the exact string 'ABC_XYZ' with anything 
following
it.  Can anyone confirm that the generated SQL should read:
  Where CustName Like 'ABC+_XYZ%' ESCAPE '+'

tia,
db

--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



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.