Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Go
New
Search
Notify
Tools
Reply
  
HDATES -- yet again
 Login/Join
 
Platinum Member
posted
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>,
 
Posts: 157 | Location: Secaucus, NJ | Registered: May 21, 2004Reply With QuoteReport This Post
Expert
posted Hide Post
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
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Reply With QuoteReport This Post
Master
posted Hide Post
TRY using LE to date you have LT to date
 
Posts: 863 | Registered: May 24, 2004Reply With QuoteReport This Post
Platinum Member
posted Hide Post
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).
 
Posts: 157 | Location: Secaucus, NJ | Registered: May 21, 2004Reply With QuoteReport This Post
  Powered by Social Strata  
 


Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.