That might've blown my idea then. I was thinking if the date was CHAR, you could substring out the month, day, year, and then concat them back together along with the '20' to make the year 2003. But, then again, that would work with a year of '99' and earlier. The only other way I know how to change the date format is in a RPG 4 program. RedMage1967 IBM Certifed - RPG IV Progammer
Although RedMAge1967 is correct about his idea not working, you can convert a numeric field to char by using the digits operator when defining a result field. However as far as I know there is no way to convert a date from one format to another in query. --------------------------------
If it ain't broke, don't fix it!
I just thought of something. There might be a way to do this using multiple queries. You would have to convert the date into a char field, them substring out the month, day and year. Have your query first of all omit years that have '00', '01', '02', '03'. (This is assuming that you don't have any dates referring to 2004.) The have the query put the date back together as month/day/'19'year. Select which fields you want in the report, and have the data saved to a file. Copy this query into a new query, put have this query SELECT years '00','01','02','03'. Then, when you put the date back together, change the '19' to '20'. Have this query add the data to the file from query 1. Then write a query to create the report you want, based on the new file. Does this make sense? RedMage1967 IBM Certifed - RPG IV Progammer
If it wasn't for adding the century to the date, it can be done by converting the date with the digits operator and then concatenating the date in correct format with a series of substring operands. Is it a necessary requirement that the date be M/D/CY?
create a copy of the DDS and change the field containing the date to a date field which will put it in *ISO. then by copying the live file into the new file the date format will be changed from yy/mm//dd to *iso. run query over new file. the origional date field must be defined as zoned numeric. You can create this temp file in qtemp as a lead in to the query function. if the field is packed or char you will have to first change field to zoned numeric. Only one problem bad dates will cause a conversion error on copy.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.