October 12, 2006, 11:02 AM
ok_dhsDate-Time field display
I have a Date-Time field (HYYMDS) in Oracle database. The master file would be something like this:
FILE=newmas, SUFFIX=SQLORA
SEGNAME=ROOT_SEG, SEGTYPE=S0, $
FIELD=FIELD1, ALIAS=FIELD1, USAGE=HYYMDS, ACTUAL=HYYMDS, MISSING=ON, $
FIELD=FIELD2, ALIAS=FIELD2, USAGE=HYYMDS, ACTUAL= HYYMDS, MISSING=ON, $
I want to display FIELD1 without the time portion; something similar to ‘January 1, 1900’ format. To do so, I could either:
1. Strip the date portion off of Date-Time (using HDATE) and then use CHGDAT function to display in MDYYX format OR
2. I could simply change FIELD1 in master file (USAGE= trMDYY, ACTUAL=DATE).
For FIELD2 I want to display both date and time and display should look like ‘January 1, 1900 9:37AM’ format. This is where I run into problems. I could not find any function that would take an ‘HYYMDS’ field and display it in ‘January 1, 1900 8:37AM’ format. Only thing I could find was either ‘HYYMDSA’ or ‘HYYMDA’. I welcome any suggestion to get this resolved. Thanks in advance.
Mike
October 12, 2006, 11:26 AM
Francis MarianiThis demo fex may be of assistance:
-SET &ECHO=ALL;
-SET &CURR_DATE = &YYMD;
-SET &CURR_TIME = EDIT(HHMMSS('A8'),'99$99$99');
-SET &CURR_DTTM = &CURR_DATE | &CURR_TIME;
DEFINE FILE CAR
CURR_DATE/HYYMDS WITH MODEL = HINPUT(14, '&CURR_DTTM', 8, 'HYYMDS');
END
TABLE FILE CAR
PRINT
CURR_DATE AS 'A1'
CURR_DATE/HYYMDSA AS 'A2'
CURR_DATE/HMTDYYSA AS 'A3'
CURR_DATE/HMtDYYSA AS 'A4'
COMPUTE CURR_YYMD/YYMD = HDATE(CURR_DATE, 'YYMD'); AS 'B1'
CURR_YYMD/MTDYY AS 'B2'
CURR_YYMD/MTRDYY AS 'B3'
CURR_YYMD/MtDYY AS 'B4'
CURR_YYMD/MtrDYY AS 'B5'
WHERE RECORDLIMIT EQ 1
END
-RUN
Francis
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
October 12, 2006, 11:31 AM
PrarieTry This
DDATE/YYMD = HDATE(WKEND_DATE, 'YYMD');
NDATE/MtrDYY = DDATE;