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
ALL T01.DEPTNO, T01.DEPTNAME, T01.MGRNO, T01.ADMRDEPT,
T02.EMPNO, T02.FIRSTNME, T02.MIDINIT, T02.LASTNAME,
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
ON T01.DEPTNO = T02.WORKDEPT LEFT OUTER JOIN
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
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