|
I'm cleaning up after a couple of days of getting behind. I don't think anyone covered this yet. > Query/400 can work with date fields. But how is an easy way to > do the following: QSYSVAL for the date format is *MDY. The date > field BIRTHDT in the record is yymmdd. > We want a report showing each person's age, in years. It's complicated at best. The obvious thing to do would be to make the birthdate field into a result field of type L by first BDYY SUBSTR(BIRTHDT, 1, 2) BDMM SUBSTR(BIRTHDT, 3, 2) BDDD SUBSTR(BIRTHDT, 5, 2) BDL DATE(BDMM||'/'||BDDD||'/'||BDYY) then doing something like BDYEARS YEARS(CURRENT - BDL) which would work as long as nobody in the file was born before 1940. Anyone older than that would screw up the plan. ------------------------------------------------------------------- Me, I'd throw some RPG at the problem and do it that way. Build a similar file and do the year figuring and put it into a field in the output file. Since you know it's birthdates, and can thus assume that the year is 19YY, which will hold you over until your Y2K programs rebuilds the file. Which it will do in 9 months anyway, right? <grin> Peter H. Coffin phcoffin@us.ibm.com +--- | This is the Midrange System Mailing List! | To submit a new message, send your mail to "MIDRANGE-L@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.