Focal Point
[CLOSED] Problem in comparing Greg date with I8 variable

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

May 05, 2010, 03:49 AM
sandyko
[CLOSED] Problem in comparing Greg date with I8 variable
Hello,

I am new to this forum.I use FOCUS 7.0.8R on ZOS 390 Mainframes to create reports.I am facing the below problem.
I need to accept current date
and then compare with gregorian date but the if condition to check is failing.
Details are below :
The following code is used to convert date into Greg date
GREGT/I8=GREGDT(LNDTENTERD,GREGT);
and I am accepting current date in A10 format which comes as CCYY/MM/DD , which then I convert to I8.
The following condition always fail when I pass FMT dates as Alphanumeric OR as I8 tried both ways.
IF GREGT GE STR-DATE
IF GREGT LE END_DATE
but this condition works fine when I pass hard coded value for example
IF GREGT GE 20100301
IF GREGT LE 20100331
I tried displaying GREGT in spool values comes as 40200635 , dont know the reason.Please help me.
I need to accept current date , based on which I calculate STR_DATE and END_DATE and then need to compare with GREGT , I cannot hard code years.

This message has been edited. Last edited by: Kerry,


FOCUS for mainframes FOCUS 7.0.8R
Z/OS 390 Mainframes
basic mainframe output only, either direct it to SPOOL or create .txt formats
May 05, 2010, 04:29 AM
Dan Satchell
Do you receive an error message? Can you also show us the code for converting the current date into start date and end date?

This message has been edited. Last edited by: Dan Satchell,


WebFOCUS 7.7.05
May 05, 2010, 05:46 AM
Kofi
quote:
40200635

This value it look like summed I8 date value, yes? 20100304 + 20100331 maybe, no?

Kofi


Client Server 8.1.05: Apache; Tomcat;Windows Server 2012
Reporting Server 8.1.05; Oracle; MS SQL; Windows Server 2012
May 05, 2010, 06:09 AM
Kofi
For date compare no use I8 but use WF date (I8YYMD or YYMD) then you see real internal date compare and not compare of numbers -

-SET &DT_BEG = DATECVT(DATEMOV(DATECVT(&YYMD,'I8YYMD','YYMD'),'BOM'),'YYMD','I8YYMD');
-SET &DT_END = DATECVT(DATEMOV(DATECVT(&YYMD,'I8YYMD','YYMD'),'EOM'),'YYMD','I8YYMD');

Kofi


Client Server 8.1.05: Apache; Tomcat;Windows Server 2012
Reporting Server 8.1.05; Oracle; MS SQL; Windows Server 2012
May 05, 2010, 07:53 AM
sandyko
Thank you all for replying to my query.
My apologies for writing a LONG mail , as I want to be descriptive in explanation.

What I am really interested to know here is why the date is getting displayed as 40200635 when I display it in greg format i.e. I8 but same field if I convert to A8 and display it gives 20100326.(26 March2010)
What I have done is I have converted my FMT dates as mentioned in last mail to I8 gregformat by first converting it to Julian and then passing julian to Greg.Conversion happens fine , but to my surprise again the date is displayed as 40200xxx where xxx is a number forgot to save last time.
Even though when I compare this greg date with GREGT date I get following error
(FOC006) THE FORMAT OF THE TEST VALUE IS INCONSISTENT WITH FIELD FORMAT:
My requirement is simple
a.) accept the current date
b.) based on which find first day and last day of previous month
c.) Then compare with GREGT ( I Cannot change this value) as follows
IF GREGT GE STR-DATE
IF GREGT LE END_DATE
where STR_DATE and END_DATE should be first day and last day of month in format ccyymmdd.
GREGT is derived as follows
GREGT/I8=GREGDT(LNDTENTERD,GREGT);

I will try with Kofi reply and see if it works.


FOCUS for mainframes FOCUS 7.0.8R
Z/OS 390 Mainframes
basic mainframe output only, either direct it to SPOOL or create .txt formats
May 05, 2010, 09:13 AM
GinnyJakes
This is just a guess because your format matches the documentation. Try format I8YYMD instead of just I8.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
May 05, 2010, 09:21 AM
Dan Satchell
I had to set DEFCENT in order to get GREGDT to produce 2010/05/05 instead of 1910/05/05.

SET DEFCENT = 20
-*
DEFINE FILE CAR
 CURRDATE/I8 WITH COUNTRY = &YYMD ;
 JULDATE/I5    = JULDAT(CURRDATE,'I5');
 GREGDT/YYMD   = GREGDT(JULDATE,'I8YYMD');
 BEG_MTH/YYMD  = DATEMOV('&YYMD','BOM');
 END_DATE/YYMD = DATEADD(BEG_MTH,'D',-1); 
 STR_DATE/YYMD = DATEMOV(END_DATE,'BOM');
END
-*
TABLE FILE CAR
 PRINT CURRDATE JULDATE GREGDT BEG_MTH STR_DATE END_DATE 
 WHERE RECORDLIMIT EQ 1 ;
END



WebFOCUS 7.7.05
May 05, 2010, 09:47 AM
Tom Flynn
No need for DEFCENT:

APP APPENDPATH IBISAMP
-RUN
DEFINE FILE CAR
XCURRDATE/I8YYMD WITH COUNTRY = &YYMD ;
CURRDATE/YYMD = XCURRDATE;
XJULDATE/I7 = JULDAT(XCURRDATE,'I7');
XGREGDT/YYMD = GREGDT(XJULDATE,'I8YYMD');
BEG_MTH/YYMD = DATEMOV('&YYMD','BOM');
END_DATE/YYMD = DATEADD(BEG_MTH,'D',-1);
STR_DATE/YYMD = DATEMOV(END_DATE,'BOM');
END
-*
TABLE FILE CAR
PRINT CURRDATE XJULDATE XGREGDT BEG_MTH STR_DATE END_DATE
WHERE RECORDLIMIT EQ 1 ;
END

-EXIT

  

CURRDATE    XJULDATE   XGREGDT    BEG_MTH    STR_DATE   END_DATE 
2010/05/05  2010125    2010/05/05 2010/05/01 2010/04/01 2010/04/30 




Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe