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



I have coded an "in" function that does exactly that.  If you're interested,
contact me directly (djohnson@powermate.com) and I'll send it to you.
Duane

> -----Original Message-----
> From: Dan [SMTP:dbcerpg@yahoo.com]
> Sent: Monday, February 10, 2003 2:55 PM
> To:   rpg400-l@midrange.com
> Subject:      "If %scan(x:y)" is not valid???
> 
> (All variable fields described here are 1-character)
> 
> I was somewhat surprised to find that 
>    C          IF        %scan( ACFLAG : 'ABC' ) 
> does not compile, even at v5r2.  I have to add a "> 0" test to make it
> work, i.e., 
>    C          IF        %scan( ACFLAG : 'ABC' ) > 0
> 
> I am trying to avoid the 
>    C  ACFLAG  SCAN   'ABC'
>    C          IF     %FOUND
> 
> Currently, I am looking at a block of code like this
>    C          IF           ACFLAG = 'A'
>    C                         AND (   W_WIPSTA = 'B'
>    C                              OR W_WIPSTA = 'H'
>    C                              OR W_WIPSTA = 'I'
>    C                              OR W_WIPSTA = 'P')
>    C                         AND (   W_BILTYP = 'C'
>    C                              OR W_BILTYP = 'F'
>    C                              OR W_BILTYP = 'R')
> and would like to simplify it thusly:
>    C          IF           ACFLAG = 'A'
>    C                         AND %scan( W_WIPSTA : 'BHIP') > 0
>    C                         AND %scan( W_BILTYP : 'CFR' ) > 0
> 
> (Actually, my example is simplified; I have more tests than that.)
> Is this understandable?  At first glance, I found it confusing.  I would
> much rather code this
> more like:
>    C          IF           ACFLAG = 'A'
>    C                         AND W_WIPSTA = ('B' 'H' 'I' 'P')
>    C                         AND W_BILTYP = ('C' 'F' 'R')
> where multiple values in a parentheses set in an "if equal" test logically
> implies an OR grouping.
> 
> Curious minds need to know...
> TIA, Dan
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.com
> _______________________________________________
> This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
> To post a message email: RPG400-L@midrange.com
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
> or email: RPG400-L-request@midrange.com
> 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 ...


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.