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

I ran into this same thing a while ago.

I don't know if it really is a precedence issue. I found that the NOT is reversing the value of an indicator. The indicator value is provided by the (some_value in %list(...)) construct.

So that makes

IF NOT (FV(i).data_type IN %list('NUMERIC' :'CHAR') );

return true/*on when FV(i).data_type has a value different than 'NUMERIC' or 'CHAR'

I haven't tried it without the outer brackets, it might work.

In SQL this would be something like

      ... where field not in (value1, value2, etc)

I doubt if you could do this with placing the 'not' in front of 'field'.

They're just two different languages in the end, isn't it?

Kind regards

Martijn van Breden
lead software architect




________________________________
Van: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> namens Vern Hamberg via RPG400-L <rpg400-l@xxxxxxxxxxxxxxxxxx>
Verzonden: donderdag 17 augustus 2023 13:03
Aan: RPG programming on the IBM i / System i <rpg400-l@xxxxxxxxxxxxxxxxxx>
CC: Vern Hamberg <vhamberg@xxxxxxxxxxxxxxx>
Onderwerp: Operation order in expressions

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.



Y'all

There was just a post about using NOT and IN in a logical test - 2 of us
responded to add parentheses.

So I did look up operator precedence in the ILE RPG Reference and found
this list -

The following list indicates the precedence of operations from highest
to lowest:
1. ()
2. Built-in functions, user-defined functions
3. unary +, unary -, NOT
4. **
5. *, /
6. binary +, binary -
7. =, <>, >, >=, <, <=, IN
8. AND
9. OR

Higher precedence are done before lower. Operations at the same level
are done left to right, except **, it says.

BTW, an expression like this, putting NOT with IN -

IF FV(i).data_type NOT IN %list('NUMERIC' :'CHAR');

is not valid in RPG, while it IS valid in SQL, IIRC.

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

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.


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.