Focal Point
HDATES -- yet again

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/6071008331

October 12, 2004, 04:55 PM
Lloyd
HDATES -- yet again
Hello All, I have a table on the AS400 with the following data:




2,004 2 20,040,201 20,040,228
2,004 3 20,040,229 20,040,403
2,004 4 20,040,404 20,040,501
2,004 5 20,040,502 20,040,529
2,004 6 20,040,530 20,040,703
2,004 7 20,040,704 20,040,731
2,004 8 20,040,801 20,040,828
2,004 9 20,040,829 20,041,002
2,004 10 20,041,003 20,041,030
2,004 11 20,041,031 20,041,127
2,004 12 20,041,128 20,050,101
2,005 1 20,050,102 20,050,129


I then run the following against it:



-SET &ECHO='ALL';
-*RETAILER WEEK IS FROM SUNDAY TO SATURDAY
SET WEEKFIRST = 1;
-**********************************************************************************
-*set up defaults
-DEFAULT &OUTPUT = 'HTML';
-DEFAULT &COMPANY = '$*';
-DEFAULT &DIVISION = '$*';
-DEFAULT &SEASON='$*';
-DEFAULT &YEAR='$*';
-DEFAULT &BRAND ='$*';
-DEFAULT &RETAILER ='$*';
-DEFAULT &INDATE = '$*';
-*
-*
-**********************************************************************************
-*SET REPORT OUTPUT
-SET &HLD = '-*';
-IF &OUTPUT EQ 'REPORT' GOTO SKIPHOLD;
-SET &HLD = IF &OUTPUT EQ 'PDF' THEN 'ON TABLE PCHOLD FORMAT PDF'
- ELSE IF &OUTPUT EQ 'EXL2K' THEN 'ON TABLE PCHOLD FORMAT EXL2K'
- ELSE &HLD ;
-SKIPHOLD
-**********************************************************************************
-*SET PATH TO GET FILES
APP MAP FOCHOLD C:\Inetpub\wwwroot\Output_Hold\
APP HOLD FOCHOLD
-*
-* GET NRF CALENDAR DATES FOR MONTH-TO-DATE
DEFINE FILE MK_CALENDR
IN_DATE/HYYMD = DT(&YYMD 12:00:00);
-IF &INDATE EQ '$*' THEN GOTO SKIP_INDATE;
-IF &INDATE EQ '' THEN GOTO SKIP_INDATE;
IN_DATE/HYYMD = DT(&INDATE 12:00:00);
-SKIP_INDATE
OUT_F/YYMD = DATECVT(NRF_FROM, 'I8YYMD','YYMD');
OUT_T/YYMD = DATECVT(NRF_TO, 'I8YYMD','YYMD');
OUT_FROM/HYYMD = HDTTM(OUT_F, 8,'HYYMD');
OUT_TO/HYYMD = HDTTM(OUT_T, 8,'HYYMD');
OUT_2/HYYMD = HADD(OUT_TO, 'DAY',1, 8,'HYYMD');
END
TABLE FILE MK_CALENDR
PRINT
IN_DATE
OUT_F
OUT_T
OUT_2
WHERE IN_DATE GE OUT_FROM;
WHERE IN_DATE LT OUT_TO;
-*ON TABLE HOLD AS CLL FORMAT ALPHA
END
-*RUN
-*READ CLL &I_FROM.A8. &I_TO.A8.
-*TYPE &I_FROM
-*TYPE &I_TO

Evrything works fine except when the "TO" date is equal to one of the "END DATES", then it all blows up for some reason because I assume it doesn't find the end date. I f I change OUT_2 for OUT_TO the n it works.

MY QUESTION, is this normal behaviour for smart dates? When you use the built in functions for converting/creating smart dates what gets put into the time portion?

Just a inquiry so I know how code smart-dates in the future.

This message has been edited. Last edited by: <Mabel>,
October 12, 2004, 07:25 PM
susannah
These aren't smart dates. they're date-times; totally different animals.
If you don't need time, or you dont need the special formatting available to datetimes, just use smart dates.
also SKIP is a java reserved word (see thread way down on this board) so you may blow up at some point, depending on your version. So i recommend changing it to SKP
October 12, 2004, 08:26 PM
TexasStingray
TRY using LE to date you have LT to date
October 14, 2004, 01:10 PM
Lloyd
In the originsal version it was LE, when I pushed the to-date 1 day forward I changed it to LT. What I'll do is follow susanah's suggestion and work with the YYMD format of the dates (without the time portion).