STRQMQRY not sum up the right total

pts.
Tags:
AS/400
Database
DB2 Universal Database
RPG
I try to use STRQMQRY to pass in a variable to run a query. It works great except the query suppose to have a grand total, for some reason, it doesn't add up right. When i run the query manually without using STRQMQRY, it works fine. Anyone know what do I have to do here? Thanks.

Answer Wiki

Thanks. We'll let you know when a new response is added.

sample ?

Discuss This Question: 3  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Heidiltl
    I found that out now when i convert the query definition to QM with join files, when i use join type match with primary file, it actually drop the record in primary if the record is not match with the second file or third file. I can use left join after i convert it to QM source, but is that any way to make it works without have to change the join statement and convert the QM to source? ie after rtvqmsrc: H QM4 05 Q 01 E V W E R 01 03 05/11/02 16:39 V 1001 050 A1: Accounts Payable Accruals by Location V 5001 004 *HEX SELECT ALL SUM(T01.OQTY09), SUM(T01.TQTY09), SUM((TQTY09*ORDP09)), SUM((TQTY09*SCSU60)) FROM AULT2F1/PMP09 T01, AULT2F1/INP35 T03, AULT2F1/INP60 T02 WHERE CONO09 = CONO35 AND ITEM09 = PNUM35 AND CONO09 = CONO60 AND ITEM09 = PNUM60 AND WHSE09 = STRC60 AND( CONO09 = &CONO AND GRNO09 0 AND INVD09 0 AND INVD09
    0 pointsBadges:
    report
  • JPLamontre
    IMO you can not use same logic between QRYDFN and QMQRY. IE you have to rework all your QRYDFN to make QMQRY. You have probably a better choice to build complete sql "on the fly" and run them directly in your RPG code or your CL code (with some tools like EXECUTESQL, see http://jplamontre.free.fr/jpltools.htm)
    0 pointsBadges:
    report
  • TomLiotta
    The same logic can be used in Query/400 or QM queries. The first problem is trying to use the long obsolete Query/400 in the first place. It shouldn't have been used for more than the past 15 years. The LEFT JOIN is actually LEFT OUTER JOIN but the word "OUTER" is optional. The same SELECT statement will give the same result in a QM query as it would embedded in RPG, but it will be far easier in QM. Tom
    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following