As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.
Join the TIBCO Community TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.
From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
Request access to the private WebFOCUS User Group (login required) to network with fellow members.
Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.
All, I want to retrieve the previous month's data. The column that I must use is called DATE_TIME and is in the HYYMDs format. The following script
-SET &ECHO=ALL;
-* store the last month's current date in &DATETMP parameter
-SET &DATETMP = DATECVT((DATEADD((DATECVT(&YYMD, 'I8YYMD', 'YYMD')),'M', -1)),'YYMD','I8YYMD');
-TYPE &DATETMP
-* use the &DATETMP parameter to build &MON_BEG_DT containing date at the beginning of the month
-SET &MON_BEG_DT2=DATECVT((DATEMOV((DATECVT(&DATETMP,'I8YYMD','YYMD')),'BOM')),'YYMD','I8YYMD');
-TYPE &MON_BEG_DT2
-* use the &DATETMP parameter to build &MON_END_DT containing date at the end of the month
-SET &MON_END_DT2=DATECVT((DATEMOV((DATECVT(&DATETMP,'I8YYMD','YYMD')),'EOM')),'YYMD','I8YYMD');
-TYPE &MON_END_DT2
-* append time
-SET &FR_DT = EDIT(&MON_BEG_DT2,'99999999') || '00.00.00.000000';
-SET &TO_DT = EDIT(&MON_END_DT2,'99999999') || '23.59.59.999999';
-TYPE &FR_DT
-TYPE &TO_DT
TABLE FILE MY_FILE
PRINT
USER_ID
DATE_TIME
BYTES_SENT
BYTES_RECEIVED
BY USER_ID
WHERE DATE_TIME FROM DT(&FR_DT) TO DT(&TO_DT);
WHERE READLIMIT EQ 10
ON TABLE COLUMN-TOTAL AS 'TOTAL' 'BYTES_RECEIVED' 'BYTES_SENT'
END
results the following error message.
-* store the last month's current date in &DATETMP parameter
-SET &DATETMP = DATECVT((DATEADD((DATECVT(20101206, 'I8YYMD', 'YYMD')),'M', -1)),'YYMD','I8YYMD');
-TYPE 20101106
20101106
-* use the &DATETMP parameter to build &MON_BEG_DT containing date at the beginning of the month
-SET &MON_BEG_DT2=DATECVT((DATEMOV((DATECVT(20101106,'I8YYMD','YYMD')),'BOM')),'YYMD','I8YYMD');
-TYPE 20101101
20101101
-* use the &DATETMP parameter to build &MON_END_DT containing date at the end of the month
-SET &MON_END_DT2=DATECVT((DATEMOV((DATECVT(20101106,'I8YYMD','YYMD')),'EOM')),'YYMD','I8YYMD');
-TYPE 20101130
20101130
-SET &FR_DT = EDIT(20101101,'99999999') || '00.00.00.000000';
-SET &TO_DT = EDIT(20101130,'99999999') || '23.59.59.999999';
-TYPE 2010110100.00.00.000000
2010110100.00.00.000000
-TYPE 2010113023.59.59.999999
2010113023.59.59.999999
TABLE FILE MY_FILE
PRINT
USER_ID
DATE_TIME
BYTES_SENT
BYTES_RECEIVED
BY USER_ID
WHERE DATE_TIME FROM DT(2010110100.00.00.000000) TO DT(2010113023.59.59.999999);
WHERE READLIMIT EQ 10
ON TABLE COLUMN-TOTAL AS 'TOTAL' 'BYTES_RECEIVED' 'BYTES_SENT'
END
0 ERROR AT OR NEAR LINE 33 IN PROCEDURE ADHOCRQ FOCEXEC *
(FOC36346) INCORRECT USE OF DATE-TIME FIELD OR CONSTANT
(FOC009) INCOMPLETE REQUEST STATEMENT
BYPASSING TO END OF COMMAND
Here, I tried to use the DT function to change the format of the date, but was not successful. I would prefer to have the format changed in the Dialogue Manager. What is the best way to change the format of &FR_DT and &TO_DT to 'HYYMDS' to successfully compare them against DATE_TIME column?
Thank you for your help,
SeyedThis message has been edited. Last edited by: SeyedG,
WebFOCUS 8.0.09 App Studio 8009 Linux Kernel-2.6 DBMS: Oracle 11g all output (Excel, HTML, AHTML, PDF)
Posts: 90 | Location: Oklahoma City, Oklahoma | Registered: July 01, 2010
Waz, I appreciate you help with this. I followed your advice, but now I am getting the following error message:
-* store the last month's current date in &DATETMP parameter
-SET &DATETMP = DATECVT((DATEADD((DATECVT(20101206, 'I8YYMD', 'YYMD')),'M', -1)),'YYMD','I8YYMD');
-TYPE 20101106
20101106
-* use the &DATETMP parameter to build &MON_BEG_DT containing date at the beginning of the month
-SET &MON_BEG_DT2=DATECVT((DATEMOV((DATECVT(20101106,'I8YYMD','YYMD')),'BOM')),'YYMD','I8YYMD');
-TYPE 20101101
20101101
-* use the &DATETMP parameter to build &MON_END_DT containing date at the end of the month
-SET &MON_END_DT2=DATECVT((DATEMOV((DATECVT(20101106,'I8YYMD','YYMD')),'EOM')),'YYMD','I8YYMD');
-TYPE 20101130
20101130
-* append time
-*-SET &FR_DT = EDIT(&MON_BEG_DT2,'99999999') || '00.00.00.000000';
-*-SET &TO_DT = EDIT(&MON_END_DT2,'99999999') || '23.59.59.999999';
-SET &FR_DT = EDIT(20101101,'99999999') | ' 00:00:00.000000';
-SET &TO_DT = EDIT(20101130,'99999999') | ' 23:59:59.999999';
-TYPE 20101101 00:00:00.000000
20101101 00:00:00.000000
-TYPE 20101130 23:59:59.999999
20101130 23:59:59.999999
TABLE FILE MY_TABLE
PRINT
USER_ID
DATE_TIME
BYTES_SENT
BYTES_RECEIVED
BY USER_ID
WHERE DATE_TIME FROM DT(20101101 00:00:00.000000) TO DT(20101130 23:59:59.999999);
WHERE READLIMIT EQ 10
ON TABLE COLUMN-TOTAL AS 'TOTAL' 'BYTES_RECEIVED' 'BYTES_SENT'
END
(FOC1400) SQLCODE IS 242 (HEX: 000000F2) XOPEN: S0003
: (242) [S0003] The conversion of a char data type to a datetime data typ
: e resulted in an out-of-range datetime value.
(FOC1407) SQL FETCH CURSOR ERROR. : MY_TABLE
Any ideas what I am doing wrong here?
Thanks again,
Seyed
WebFOCUS 8.0.09 App Studio 8009 Linux Kernel-2.6 DBMS: Oracle 11g all output (Excel, HTML, AHTML, PDF)
Posts: 90 | Location: Oklahoma City, Oklahoma | Registered: July 01, 2010
Waz, Thank you for your help. The table that I am reading is a SQL Server table. Here is the code and the resulting error:
-SET &ECHO=ALL;
SET TRACEOFF=ALL
SET TRACEUSER=CLIENT
SET TRACEON=STMTRACE//CLIENT
-* store the last month's current date in &DATETMP parameter
-SET &DATETMP = DATECVT((DATEADD((DATECVT(&YYMD, 'I8YYMD', 'YYMD')),'M', -1)),'YYMD','I8YYMD');
-TYPE &DATETMP
-* use the &DATETMP parameter to build &MON_BEG_DT containing date at the beginning of the month
-SET &MON_BEG_DT2=DATECVT((DATEMOV((DATECVT(&DATETMP,'I8YYMD','YYMD')),'BOM')),'YYMD','I8YYMD');
-TYPE &MON_BEG_DT2
-* use the &DATETMP parameter to build &MON_END_DT containing date at the end of the month
-SET &MON_END_DT2=DATECVT((DATEMOV((DATECVT(&DATETMP,'I8YYMD','YYMD')),'EOM')),'YYMD','I8YYMD');
-TYPE &MON_END_DT2
-* append time
-*-SET &FR_DT = EDIT(&MON_BEG_DT2,'99999999') || '00.00.00.000000';
-*-SET &TO_DT = EDIT(&MON_END_DT2,'99999999') || '23.59.59.999999';
-SET &FR_DT = EDIT(&MON_BEG_DT2,'99999999') | ' 00:00:00.000000';
-SET &TO_DT = EDIT(&MON_END_DT2,'99999999') | ' 23:59:59.999999';
-TYPE &FR_DT
-TYPE &TO_DT
TABLE FILE MY_TABLE
PRINT
USER_ID
DATE_TIME
BYTES_SENT
BYTES_RECEIVED
BY USER_ID
WHERE DATE_TIME FROM DT(&FR_DT) TO DT(&TO_DT);
WHERE READLIMIT EQ 10
ON TABLE COLUMN-TOTAL AS 'TOTAL' 'BYTES_RECEIVED' 'BYTES_SENT'
END
Here is the error:
SET TRACEOFF=ALL
SET TRACEUSER=CLIENT
SET TRACEON=STMTRACE//CLIENT
-* store the last month's current date in &DATETMP parameter
-SET &DATETMP = DATECVT((DATEADD((DATECVT(20101206, 'I8YYMD', 'YYMD')),'M', -1)),'YYMD','I8YYMD');
-TYPE 20101106
20101106
-* use the &DATETMP parameter to build &MON_BEG_DT containing date at the beginning of the month
-SET &MON_BEG_DT2=DATECVT((DATEMOV((DATECVT(20101106,'I8YYMD','YYMD')),'BOM')),'YYMD','I8YYMD');
-TYPE 20101101
20101101
-* use the &DATETMP parameter to build &MON_END_DT containing date at the end of the month
-SET &MON_END_DT2=DATECVT((DATEMOV((DATECVT(20101106,'I8YYMD','YYMD')),'EOM')),'YYMD','I8YYMD');
-TYPE 20101130
20101130
-* append time
-*-SET &FR_DT = EDIT(&MON_BEG_DT2,'99999999') || '00.00.00.000000';
-*-SET &TO_DT = EDIT(&MON_END_DT2,'99999999') || '23.59.59.999999';
-SET &FR_DT = EDIT(20101101,'99999999') | ' 00:00:00.000000';
-SET &TO_DT = EDIT(20101130,'99999999') | ' 23:59:59.999999';
-TYPE 20101101 00:00:00.000000
20101101 00:00:00.000000
-TYPE 20101130 23:59:59.999999
20101130 23:59:59.999999
TABLE FILE LOG_DETAILS
PRINT
USER_ID
DATE_TIME
BYTES_SENT
BYTES_RECEIVED
BY USER_ID
WHERE DATE_TIME FROM DT(20101101 00:00:00.000000) TO DT(20101130 23:59:59.999999);
WHERE READLIMIT EQ 10
ON TABLE COLUMN-TOTAL AS 'TOTAL' 'BYTES_RECEIVED' 'BYTES_SENT'
END
16.28.59 AE SELECT TOP 10 T1."DATE_TIME",T1."USER_ID",T1."BYTES_SENT",
16.28.59 AE T1."BYTES_RECEIVED" FROM wslogdb70.dbo.log_details T1 WHERE
16.28.59 AE (T1."DATE_TIME" BETWEEN '16777216 00:00:00.000' AND '16777216
16.28.59 AE 00:00:00.000') ORDER BY T1."USER_ID";
(FOC1400) SQLCODE IS 242 (HEX: 000000F2) XOPEN: S0003
: (242) [S0003] The conversion of a char data type to a datetime data typ
: e resulted in an out-of-range datetime value.
(FOC1407) SQL FETCH CURSOR ERROR. : MY_TABLE
Thank you,
Seyed
WebFOCUS 8.0.09 App Studio 8009 Linux Kernel-2.6 DBMS: Oracle 11g all output (Excel, HTML, AHTML, PDF)
Posts: 90 | Location: Oklahoma City, Oklahoma | Registered: July 01, 2010
and that fixed the error. I just have one more question though, why hour, minute and second are separated by a ':' but millisecond is separated by a '.'?
Thank you very much,
SeyedThis message has been edited. Last edited by: SeyedG,
WebFOCUS 8.0.09 App Studio 8009 Linux Kernel-2.6 DBMS: Oracle 11g all output (Excel, HTML, AHTML, PDF)
Posts: 90 | Location: Oklahoma City, Oklahoma | Registered: July 01, 2010
I guess it is because of the different meaning of the parts. When you separate hours from minutes, (15:59) you do not want to be able to misinterpret it (15.59, which may mean something else entirely). Same for separating minutes and seconds. But seconds and milliseconds can't be misinterpreted, so there you can use the . for separation.
GamP
- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007