I have been working on a default date range. Currently it changes the dates at midnight and I need it to change at 11am EST. Can I change this code to reflect this change?
-DEFAULT &START_NUM = -30;
-DEFAULT &END_NUM = -1;
-DEFAULT &DATE_UNIT = 'D';
-SET &TODT=DATECVT(DATEADD(DATECVT(&MDYY,'I8MDYY','MDYY'),'&DATE_UNIT.EVAL',&END_NUM),'MDYY','I8MDYY');
-SET &FROMDT=DATECVT(DATEADD(DATECVT(&TODT,'I8MDYY','MDYY'),'&DATE_UNIT.EVAL',&START_NUM),'MDYY','I8MDYY');
-SET &FROMDT = IF &FROMDT.LENGTH NE 8 THEN '0&FROMDT.EVAL' ELSE &FROMDT;
-SET &TODT = IF &TODT.LENGTH NE 8 THEN '0&TODT.EVAL' ELSE &TODT;
-IF &WFV_LANG EQ en THEN GOTO L_EN;
-* Set Date for other contries in DMYY format
-SET &FROMDT = EDIT(&FROMDT,'$$99')||'/'||EDIT(&FROMDT,'99')||'/'||EDIT(&FROMDT,'$$$$9999');
-SET &TODT = EDIT(&TODT,'$$99')||'/'||EDIT(&TODT,'99')||'/'||EDIT(&TODT,'$$$$9999');
-GOTO L_ENDDATE
-* Set Date for english in MDYY format
-L_EN
-SET &FROMDT = EDIT(&FROMDT,'99/99/9999');
-SET &TODT = EDIT(&TODT,'99/99/9999');
-L_ENDDATE
-TYPE &FROMDT - &TODT
This message has been edited. Last edited by: Kerry,
WebFOCUS 7.6.8 Windows XP HTML
April 27, 2010, 02:13 PM
Dan Satchell
You could experiment with DM variable &TOD or function HHMMSS such that if the time is later than 11:00:00, use (&MDDYY - 1), else use &MDYY.
WebFOCUS 7.7.05
April 27, 2010, 02:21 PM
PBrightwell
Either -SET &TM=HHMMSS('A8'); or &TOD will give you the system time. (&TOD is usually the time the job starts). Check the results for less than '11.00.00' and subtract 1 day from the dates.
-SET &CURRDT=IF &TM LT '11.00.00' THEN AYMD(&YYMD,-1,'I8YYMD') ELSE &YYMD;
Pat WF 7.6.8, AIX, AS400, NT AS400 FOCUS, AIX FOCUS, Oracle, DB2, JDE, Lotus Notes
April 27, 2010, 02:32 PM
GamP
If you run the next statement, you'll see that it gives you the current time + 1 hour. If you take out the date part from the variable &NOW, then you'll have your date change at 11 pm in stead of at midnight.
-* File timezone.fex
-*-- System call to write the registry value to a file
! REG QUERY HKLM\SYSTEM\CURRENTCONTROLSET\CONTROL\TIMEZONEINFORMATION /V ACTIVETIMEBIAS > TZ.TXT
-*-- Filedef the generated file so that it can be read by WebFOCUS
FILEDEF TZ DISK ./TZ.TXT (LRECL 80 RECFM V
-RUN
-*-- Loop through the file to find the line that contains the required value
-LOOP
-READ TZ &LINE.A80.
-IF &LINE OMITS 'ACTIVETIMEBIAS' GOTO LOOP;
-RUN
-*-- extract the value using GETTOK
-SET &HEX=GETTOK(&LINE, 128, -1, 'x', 10, 'A10');
-*-- Decode the hex value returned by Windows to a decimal value
-SET &OFFSET =DECODE &HEX(
- 'fffffd30' '-720', 'fffffd6c' '-660', 'fffffda8' '-600', 'fffffde4' '-540',
- 'fffffe20' '-480', 'fffffe5c' '-420', 'fffffe98' '-360', 'fffffed4' '-300',
- 'ffffff10' '-240', 'ffffff2e' '-210', 'ffffff4c' '-180', 'ffffff88' '-120',
- 'ffffffc4' '-60', '0' '0', '3c' '60', '78' '120',
- 'b4' '180', 'd2' '210', 'f0' '240', '10e' '270',
- '12c' '300', '14a' '330', '159' '345', '168' '360',
- '186' '390', '1a4' '420', '1e0' '480', '21c' '540',
- '23a' '570', '258' '600', '294' '660', '2d0' '720',
- '30c' '780' ELSE '0');
-*-- Set up the number of hours to offset GMT time
-SET &&OFFSETHOURS = -(&OFFSET / 60);
-*-- Set up the number of minutes to offset GMT time
-SET &&OFFSETMINS = -(&OFFSET);