[SOLVED] Hot to convert a packed date field to display in MDYY format
Here is the problem, I am working with SMF records which are VSAM records. They come with FOCUS. The field in the SMFFIX MASTER has these attibutes FIELD=SMFOFDTE,,P9 ,P4 ,$ DATE, PACKED (0CYYDDDF)
The following DEFINEs: PDATE/P9=SMFOFDTE; IDATE/I9=PDATE; ODATE/I8YYMD=DTYMD(IDATE, ODATE); SMFDATE/MDYY=ODATE;
Your code looks OK, though you could probably skip a couple of steps, but is the clue in the comment at the end of the metadata line, "0CYYDDDF"? Is it possible that the field does not contain a conventional date?
I don't know what the "F" stands for, but looking at "113245" - does the 11 mean 2011, is the 324 a component of a Julian date?
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
September 27, 2013, 05:36 AM
GamP
Tom is almost right. From the IBM info center: Definition of the format used to represent dates (OCYYDDD+) The numbers are written in +ve byte packed decimal. '0C' is the number of centuries since 1900. All dates in the 21st century have '01'. 'YY' is the year. 'DDD' is the day of the year. The first day of the year is '1' and the last day of the year '366'. '+' is hard coded as 0xC. So:
10 January 2007 = 0107010C
1 January 2001 = 0101001C
31 December 2012 = 0112366C
GamP
- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
September 27, 2013, 11:58 AM
Rhonda
Thank you for all for your help! Here are the defines I created I may have taken more steps than necessary to get what I wanted but it was worth it. Thanks again! ************************* PDATE/P6=SMFOFDTE; IDATE/I6=PDATE; ZDATE/A5=EDIT(IDATE,'$99999'); XDATE/I5=EDIT(ZDATE); GREG_DATE/I8 = GREGDT(XDATE,'I8'); ******************************** Rhonda
WebFOCUS & ReportCaster 8.1.05, 7.7.03 - AIX/LINUX, FOCUS 7.6.13 MVS, Output PDF, XLS-XLSX, DOCX and HTML