Thanks Elvis.

One thing I didn't mention was in our test system, which is V5R4, the QM
query works correctly. Our production system at V5R2 does not. The
command
strqmqry qmqry(imdmdcmpqm) setvar((DMD_C '001486') (DMD_P '001487'))
is correct. I think I need to start looking at group PTFs.


Loyd Goodbar
Senior programmer/analyst
BorgWarner
TS Water Valley
662-473-5713
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Elvis Budimlic
Sent: Wednesday, August 01, 2007 14:42
To: 'Midrange Systems Technical Discussion'
Subject: RE: SQL works in iNav but not QMQRY

You're on the right track with apostrophes, this is always a problem
with QM
queries.

I use a trick learned from this list, namely replacing quotes with
another
parm. Let's say your qm query looks like this:

INSERT INTO yourLib/yourFile
SELECT * FROM yourLib/yourFile2
WHERE F1 = &q&DMD_C&q AND F2 = &q&DMD_P&q

Then your QM invocation would look like this:

STRQMQRY QMQRY(IMDMDCMPQM) SETVAR((DMD_C 001486) (DMD_P 001487) ('q'
''''))


Of course, you can effect this using many apostrophes in your CL, but
this
seems cleaner to me.

Elvis

Celebrating 10-Years of SQL Performance Excellence
http://centerfieldtechnology.com/training.asp

-----Original Message-----
Subject: SQL works in iNav but not QMQRY

I've got a pretty long SQL statement that works in iSeries Navigator's
run SQL scripts, as well as in the 5250 STRSQL. However, it does not
work when compiled as a QMQRY. (We're using QM queries because we need
to pass a couple of parameters.)

Here are the messages I receive:

STRQMQRY QMQRY(IMDMDCMPQM) SETVAR((DMD_C 001486) (DMD_P 001487))

CONNECT to relational database S10297EC completed.

Current connection is to relational database S10297EC.

SET CONNECTION to relational database S10297EC completed.

Comparison operator = operands not compatible.

RUN QUERY command failed with SQLCODE -401.

RUN QUERY command ended due to error.

STRQMQRY command failed.

Connection to relational database S10297EC ended.

SQL cursors closed.



For the "comparison operator = operands not compatible," I receive no
additional information indicating which of several comparison operators
are in error. Also ran this variation, with the same (failing) results.

strqmqry qmqry(imdmdcmpqm) setvar((DMD_C '001486') (DMD_P '001487'))



Has anyone run into this and can provide some guidance? Again, the SQL
statement runs without error in iSeries Navigator and interactively via
STRSQL. Gives error when compiled as a QM query.



I can post the SQL if necessary but it's really long.



Thanks,

Loyd




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.