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



OK, that was actually the code for my (unfinshed) @LIKE function - silly me!
It should be:

*=====================================================================
* @in(): Check for a string in a series of other strings
*=====================================================================
P @in B Export
D PI N
D pSearch 512A Const Varying
D pScan1 512A Const Varying
D pScan2 512A Const Varying Options(*Nopass)
D pScan3 512A Const Varying Options(*Nopass)
D pScan4 512A Const Varying Options(*Nopass)
D pScan5 512A Const Varying Options(*Nopass)
D pScan6 512A Const Varying Options(*Nopass)
D pScan7 512A Const Varying Options(*Nopass)
D pScan8 512A Const Varying Options(*Nopass)
D pScan9 512A Const Varying Options(*Nopass)
D pScan10 512A Const Varying Options(*Nopass)
*---------------------------------------------------------------------
/free

if ( pSearch = pScan1 ) or
( %parms > 2 and pSearch = pScan2 ) or
( %parms > 3 and pSearch = pScan3 ) or
( %parms > 4 and pSearch = pScan4 ) or
( %parms > 5 and pSearch = pScan5 ) or
( %parms > 6 and pSearch = pScan6 ) or
( %parms > 7 and pSearch = pScan7 ) or
( %parms > 8 and pSearch = pScan8 ) or
( %parms > 9 and pSearch = pScan9 ) or
( %parms > 10 and pSearch = pScan10 );
return *on;
else;
return *off;
endif;

begsr *pssr;
return *off;
endsr;

/end-free
P E

Rory

On Fri, Mar 5, 2010 at 2:08 PM, Rory Hewitt <rory.hewitt@xxxxxxxxx> wrote:

Like this?

if @in( 'me' : 'john' : 'mike' : 'home' : 'seth' );
dsply 'Yup, it''s there!';
else;
dsply 'Nope, it''s not there!';
endif;


*=====================================================================
* @in(): Scan for a string in a series of other strings
*=====================================================================
P @in B Export
D PI N
D pSearch 512A Const Varying
D pScan1 512A Const Varying
D pScan2 512A Const Varying Options(*Nopass)
D pScan3 512A Const Varying Options(*Nopass)
D pScan4 512A Const Varying Options(*Nopass)
D pScan5 512A Const Varying Options(*Nopass)
D pScan6 512A Const Varying Options(*Nopass)
D pScan7 512A Const Varying Options(*Nopass)
D pScan8 512A Const Varying Options(*Nopass)
D pScan9 512A Const Varying Options(*Nopass)
D pScan10 512A Const Varying Options(*Nopass)
*---------------------------------------------------------------------
D qusec DS Likeds(qusec_t) Inz(*Likeds)
*---------------------------------------------------------------------
/free

lead = %subst( pSearch : 1 : 1 ) = '%';
trail = %subst( pSearch : %len( pSearch ) : 1 ) = '%';

if ( %scan( pSearch : pScan1 ) > 0 ) or
( %parms > 2 and %scan( pSearch : pScan2 ) > 0 ) or
( %parms > 3 and %scan( pSearch : pScan3 ) > 0 ) or
( %parms > 4 and %scan( pSearch : pScan4 ) > 0 ) or
( %parms > 5 and %scan( pSearch : pScan5 ) > 0 ) or
( %parms > 6 and %scan( pSearch : pScan6 ) > 0 ) or
( %parms > 7 and %scan( pSearch : pScan7 ) > 0 ) or
( %parms > 8 and %scan( pSearch : pScan8 ) > 0 ) or
( %parms > 9 and %scan( pSearch : pScan9 ) > 0 ) or
( %parms > 10 and %scan( pSearch : pScan10 ) > 0 );
return *on;
else;
return *off;
endif;

begsr *pssr;
return *off;
endsr;

/end-free
P E

This one only works with strings and it's pretty basic, but you get the
idea...

Rory

On Fri, Mar 5, 2010 at 1:22 PM, Vern Hamberg <vhamberg@xxxxxxxxxxx> wrote:

[...]But you could have it so

that only the value to test and the first comparison value are required
- the rest could be *NOPASS.

OK - time for real work!!

Vern





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.