TABLE FILE XXX PRINT ----- ----- WHERE HDATE(DATE_FIELD,'YYMD') EQ YESTERDAY AND ------------------------ END
DATE_FIELD is in 'HYYMDm' format.
Is there anything that looks incorrect in the code? How can I achieve this in any other way? Please help.This message has been edited. Last edited by: Prash1983,
(FOC1400) SQLCODE IS -99999 (HEX: FFFE7961) : [01S01] [IBM][CLI Driver] CLI0165E Error in row. SQLSTATE=01S01 [5U026] : [IBM][CLI Driver][DB2/AIX64] SQL0969N There is no message text corresp : onding to SQL error "-4712" in the message file on this workstation. Th : e error was returned from module "SQLRW082" with original tokens "SQRR1 : 11". SQLSTATE=5U026 (FOC1407) SQL FETCH CURSOR ERROR. (FOC1400) SQLCODE IS 1400 (HEX: 00000578) : SQLCODE IS -99999 (HEX: FFFE7961) (FOC1407) SQL FETCH CURSOR ERROR. : XXX
Please note that the code works when hard-coded value is passed instead of a variable.
webFOCUS 7.6.x, z/OS(Mainframes), Excel and HTML
May 27, 2010, 01:49 PM
Francis Mariani
I would never use a DEFINE based WHERE statement - the WHERE does not get passed to SQL, WebFOCUS will return all the data before applying the WHERE.
This is the message you'd get:
FOC2598 - FOCUS IF/WHERE TEST CANNOT BE PASSED TO SQL : WHERE expression
The right way to do it would be to create a Dialogue Manager variable with yesterday's date (to use Date functions in Dialogue Manager you need to use DATECVT to convert a string to a date and then back to a string) and use yesterday and today as from-to selection criteria. Something like this:
-SET &YESTERDAY = DATECVT((DATEADD((DATECVT(&YYMD, I8YYMD, YYMD)), D, -1)), YYMD, I8YYMD);
TABLE FILE TIME_CNTL
PRINT
*
WHERE UPDATE_TIMESTAMP GE DT('&YESTERDAY 00:00:00.000') AND UPDATE_TIMESTAMP LT DT('&YYMD 00:00:00.000');
END
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
May 27, 2010, 01:54 PM
Prarie
Sorry that did not work, we have it working here...but not sure on which databases.
Yes Fransis that is the best way to go...
May 27, 2010, 01:59 PM
Prash1983
Thanks a lot Francis! This works! I will keep that in mind what you said about NOT using "DEFINE based WHERE statement". Thanks again!!