|
Satria, Try this; 1. Create a souce file MYLIB/QQMQRYSRC 2. Create a member (MBR1) and place the following in it: SELECT stock, desc, ucost, po, podate, vendor FROM mylib/file1 a WHERE EXISTS (SELECT count(*) FROM mylib/file1 b WHERE a.stock = b.stock HAVING a.podate = MAX(b.podate)) ORDER BY stock 3. In your CL program place the following: CRTQMQRY QMQRY(QTEMP/QRY1) + SRCFILE(mylib/qqmqrysrc) SRCMBR(mbr1) STRQMQRY QMQRY(qtemp/qry1) OUTPUT(*OUTFILE) + OUTFILE(qtemp/qrypf) Change MYLIB to the correct library and FILE1 to the correct file. You can change the OUTPUT to *, *PRINT or *OUTFILE. This should give you the results you want. I don't know what the response time will be. If you decide to try it, let me know how it works. HTH, Rich Dotson RT3 Consulting Services, Inc. P.O. Box 126 Lorain, OH 44052 1-216-556-1710 rich_dotson@centuryinter.net +--- | This is the Midrange System Mailing List! | To submit a new message, send your mail to MIDRANGE-L@midrange.com. | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com. | To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
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.