There are PTFs for V5R4 and up that have changed how RTVMQRY works. First of all, it now handles type 2 and 3 JOINs correctly - for the longest time, they were treated as type 1s.

And they now produce statements using JOIN syntax, not WHERE syntax. Here's the result for, I think, a type 2 -

H QM4 05 Q 01 E V W E R 01 03 12/09/14 11:56
V 1001 050
V 5001 004 *HEX
SELECT
ALL T01.DEPTNO, T01.DEPTNAME, T01.MGRNO, T01.ADMRDEPT, T01.LOCATION,
T02.EMPNO, T02.FIRSTNME, T02.MIDINIT, T02.LASTNAME, T02.WORKDEPT,
T02.PHONENO, T02.HIREDATE, T02.JOB, T02.EDLEVEL, T02.SEX,
T02.BIRTHDATE, T02.SALARY, T02.BONUS, T02.COMM, T03.EMPNO,
T03.PROJNO, T03.ACTNO, T03.EMPTIME, T03.EMSTDATE, T03.EMENDATE
FROM LABQMXX/DEPARTMENT T01 LEFT OUTER JOIN
LABQMXX/EMPLOYEE T02
ON T01.DEPTNO = T02.WORKDEPT LEFT OUTER JOIN
LABQMXX/EMPPROJACT T03
ON T02.EMPNO = T03.EMPNO
WHERE T01.DEPTNO = 'A00'

The bug was finally fixed - it has been far too long. Still ANZQRY uses a message about the JOIN types that is bogus - at least it did, last year.

I still strongly recommend using RTVQMQRY to move from QRYDFNs to using SQL. It can even turn merge fields into substitution variables, which is really cool, IMO.

The PTFs were as follows, as of April, 2011 - they may be superseded, of course.

V5R4 SI42309
6.1 SI42345
7.1 SI42363

Vern

On 9/14/2012 10:34 AM, rob@xxxxxxxxx wrote:
While I've written a magazine article a decade or so ago on using RTVQMQRY
I discourage it's use. For one, you should run ANZQMQRY, some just won't
come through right.
Another reason is that RTVQMQRY is a good way to learn how to do SQL the
WRONG way. Like using WHERE instead of JOIN.

Now, I'm not one of those who suggest you learn assembler in order to
become a better programmer, but browsing through the SQL functions and
buying a book or two can be a real help. Although I have a coworker who
writes some intense sql and claims he learned it all from the IBM manuals.

Also, you really can't use a bulk of the BIF's in Query/400. Hey, I liked
it back in the day. But I won't use it because it's too easy to get
started with a Query and stay within it's limitations because you've
already got started with it, than to stop and restart it in SQL and do it
right.


Rob Berendt


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.