×
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.
Vern,
The SQL preprocessor probably follows the operator "precedence" rules of SQL -- for better or worse (in this case).
When there is any doubt at all, I always use parentheses. IMHO, it never hurts to use extra parentheses to "document" what you really want, as far as the "evaluation order" of an expression is concerned, for the benefit of the compiler, and for anyone in the future who may need to maintain the code.
All the best,
Mark S. Waterbury
On Thursday, June 9, 2022, 12:50:21 PM EDT, Vern Hamberg via RPG400-L <rpg400-l@xxxxxxxxxxxxxxxxxx> wrote:
Y'all
I just tried the fairly new IN operator, to see if a value is in a list
of items. The list has to be in an array, it seems, at 7.3, anyhow, that
%LIST() is basically hard-coded thing.
Anyhow, I have an 99-element zoned(2:0) array, segXcpt. I also have a
data structure element, inCtFcr.MKTSG#, that is zoned(2:0).
blox is a count of how many elements I loaded into segXcpt.
So this statement compiles fine -
if inCtFcr.MKTSG# in %subarr(segXcpt : 1 : blox);
The following statement gives me an RNF7421 compile error (Operands are
not compatible with the type of operator) -
if not inCtFcr.MKTSG# in %subarr(segXcpt : 1 : blox);
This is identical, syntactically, to the example in the documentation -
In the following example, the IF statement is true if item is not in the
array availableItems. %SUBARR is used to limit the number of array
elements checked.
IF NOT item IN %SUBARR(availableItems : 1 : numAvailabeItems);
What DID work is this statement, where I used parentheses - there is no
hint of the need for the parentheses, even in the 7.5 documentation, IIRC.
if not (inCtFcr.MKTSG# in %subarr(segXcpt : 1 : blox));
It looks like the RPG parser is tying the NOT to the subfield after it
and treating it all as an indicator type. Something like that.
BTW, I had tried this, which I think should be allowed, and it was a
different syntax error -
if inCtFcr.MKTSG# not in %subarr(segXcpt : 1 : blox);
So I probably need to submit a case but wanted to run it by y'all first.
Regards
Vern
As an Amazon Associate we earn from qualifying purchases.
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.