Carel - I didn't think of the SQL DESCRIBE when I replied. That puts an interesting twist on things.


Even so, as a couple of us replied, he needs is a pair of parentheses, since NOT has higher precedence than IN in RPG. That assumes he is truly checking strings, as you pointed out. and NOT requires a logical value.


Cheers
Vern


On Thu, 17 Aug, 2023 at 2:21 PM, Carel via MIDRANGE-L <midrange-l@xxxxxxxxxxxxxxxxxx> wrote:


To: midrange-l@xxxxxxxxxxxxxxxxxx
Cc: coteijgeler@xxxxxxxxx
Late in te discussion.

If those column details have been retrieved with an SQL DESCRIBE
operation, then the data_type has a numeric value, not a character
value, IIRC.
You have to convert those values for data_type to character descriptions.

You have to check the SQL Reference in one of the appendices to see what
data type gets which numeric SQL value.
Beware: there are 2 values for each data type, based on null values
capable fields.

Kind regards,
Carel Teijgeler.

Op 17-8-2023 om 05:04 schreef Jack Callahan:
Have an data structure FV to hold column details for a given table loaded
using SQL FETCH including a column data_type defined as a varchar(8).
RowsFetched contains the number of columns defined. I would like to verify
that all the data_types defined agree to a list of values ('NUMERIC' or
'CHAR'). Tried a code snippet looks something like this:

isValid = '1';
FOR i=1 TO RowsFetched;
IF NOT FV(i).data_type IN %list('NUMERIC' :'CHAR');
isValid = '0';
ENDIF;
ENDFOR;

Compile fails with RNF7421, to wit:

"Operands are not compatible with the type of operator.

Cause . . . . . : Operands must be of class character, graphic, or UCS-2
for character operations; numeric for arithmetic operations; and indicator
for logical and relational operations. In a comparison operation, both
operands must have the same data type. The specification is ignored."
Obviously I can convert the IN to a compound logical comparison to make
the program work.
What I'd like to learn is what data type is being assigned to the %list
expression terms. I can't seem to make the terms compatible. Or is the
problem using an element of the data structure as one of the terms? Or is
it something else altogether?

Any thoughts welcome

Jack


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.