|
> Now the dilema is how to get a mmddyy field to flow by year. > I will do a logical if need be, It can be done with OPNQRYF but it might be easier with a logical and more straight forward for the next guy to debug. You have to use MAPFLD to create the YEAR field. But OPNQRYF has a requirement that any KEYFLD must be in the record format also. So you have to create a "dummy" file like the file you are querying with the MAPFLD added to the end. In my example, I duplicated my vendor file using the SQL command CREATE TABLE ... LIKE. Then I added a CHAR(4) field called DATEYR that is the ccyy portion of a date field called VNADDD I have in the vendor table. Here is the OPNQRYF command that substrings out the ccyy portion of the date and order the query by it. The FORMAT keyword refers to the table I created like the vendor table but with the additionl MAPFLD. OPNQRYF FILE((XBDB/VEND)) FORMAT(SCOTT/VENDDATE *ONLY) KEYFLD((*MAPFLD/YEAR)) MAPFLD((ADDDATE VNADDD *CHAR 8) (YEAR '%SST(adddate 1 4)' *CHAR 4)) ---------------------- Scott Scott A. Schollenberger Chief Technology Officer TENEX Systems, Inc. 2011 Renaissance Blvd., Suite 100 King of Prussia, PA 19406 Phone: 610-239-9988 Ext. 305 Fax: 610-239-9995 E-mail: saschollenberger@xxxxxxxxxxxx Web: www.tenexsys.com IBM Certified Specialist - eServer i5 iSeries Technical Solutions Implementer V5R3 CONFIDENTIALITY NOTICE: This email message, including any attachments, is for the sole use of the intended recipient(s) and contains confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. ---------------------- "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." --Benjamin Franklin ----------------------
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.