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.
As we get the current date by &YYMD is there way to get or compare the time with current time ? Thanks for your helpThis message has been edited. Last edited by: Kerry,
Unfortunately &TOD is static. It is set at the beginning of the current process and does not change. If you wnat the actual time at various stages during your process use the HHMMSS function as it returns the system time at the instant.
Posts: 140 | Location: Adelaide South Australia | Registered: October 27, 2006
thanks, what I actually need is if current time is let's say GE 06:00:00 and LE 08:00:00 then run the program, else do not run the program. With current date it works as I can use &YYMD but what should I use for current time? Thanks for your help
-BEGINN -SET &STARTTIME = '06:00:00'; -SET &ENDTIME = '08:00:00'; -SET &TIME = HHMMSS('A8'); -IF ((&TIME GE &STARTTIME ) AND (&TIME LE &ENDTIME ))GOTO INTIME; -LBL0 -NOTINTIME -TYPE SORRY YA MISSED THE TIME ZONE -GOTO XIT -INTIME -TYPE OK YOU MADE IT ON TIME -XIT
Thanks, this is great, but I still have an issue. it seems that it does not care for the minutes. In the example that you gave me I thought it should display 'SORRY YA MISSED THE TIME ZONE' if the current time is 8:10 but it displays 'OK YOU MADE IT ON TIME' . It seems it is only conparing the hours and not minutes or seconds. Any suggestions??? Thank you very much
BEGINN -SET &STARTTIME = '06:00:00'; -SET &ENDTIME = '08:00:00'; -SET &TIME = HHMMSS('A8'); -IF ((&TIME GE &STARTTIME ) AND (&TIME LE &ENDTIME ))GOTO INTIME; -LBL0 -NOTINTIME -TYPE SORRY YA MISSED THE TIME ZONE -GOTO XIT -INTIME -TYPE OK YOU MADE IT ON TIME -XIT
my mistake. i had ':' in the startdate and enddate. I should have used '.' see below...
-SET &ECHO = 'ALL'; -SET &STARTTIME = '06.00.00'; -SET &ENDTIME = '12.29.00'; -SET &TIME = HHMMSS('A8'); -TYPE &TIME -IF ((&TIME GE &STARTTIME ) AND (&TIME LE &ENDTIME ))GOTO INTIME; -NOTINTIME -TYPE SORRY YA MISSED THE TIME ZONE -GOTO XIT -INTIME -TYPE OK YOU MADE IT ON TIME -XIT
That may be because the HHMMSS function returns . not : between the hours, minutes and seconds. Your &STARTTIME and &TIME has different separators.
Try this:
-SET &ECHO=ALL;
-BEGINN
-SET &STARTTIME = '12:00:00';
-SET &ENDTIME = '14:00:00';
-SET &TIME = EDIT(HHMMSS('A8'),'99$:99$:99');
-IF ((&TIME GE &STARTTIME ) AND (&TIME LE &ENDTIME ))GOTO INTIME;
-LBL0
-NOTINTIME
-TYPE SORRY YA MISSED THE TIME ZONE
-GOTO XIT
-INTIME
-TYPE OK YOU MADE IT ON TIME
-XIT
I'm not sure if the time returned with the HHMMSS function is always in 24 hour format.
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
Seeing that it's a function, it really doesn't matter what is within the parenthesis. I always used &TOD, just as a reference to TOD. But, even though the documentation (which is geared towards DEFINE and COMPUTE) states that it should be the OUTFIELD, anything works there. I, imho, don't see wasting the DEFINE or COMPUTE (on every row) for a semi-constant value. Use DM and the associated variable. Besides, using a "AND COMPUTE NOWTIME/A8 = HHMMSS(NOWTIME); NOPRINT" (as per F1 HELP) may cause different times to be displayed in the heading (on a very large report or when executed on a very slow system (I've seen this. Really, I did).
This was just for the fun of it, Doug
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005
But, while I'm here talking (ok, typeing) about TIME functions. Does anyone have a TIMEDIF which is kind of like the DATEDIF, only with TIME? Great for time stamping...
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005
DEFINE FUNCTION TIMEDIFF(STRT_TIME/A8,END_TIME/A8)
-*SPLIT OUT HH MM SS; CONVERT TO 'I' FOR STRT_TIME AND END_TIME
STRT_HH/I2=EDIT(EDIT(STRT_TIME,'99'));
STRT_MM/I2=EDIT(EDIT(STRT_TIME,'$$$99'));
STRT_SS/I2=EDIT(EDIT(STRT_TIME,'$$$$$$99'));
STRT_SEC/I9=(STRT_HH * 3600)+(STRT_MM * 60) + STRT_SS ;
END_HH/I2=EDIT(EDIT(END_TIME,'99'));
END_MM/I2=EDIT(EDIT(END_TIME,'$$$99'));
END_SS/I2=EDIT(EDIT(END_TIME,'$$$$$$99'));
END_SEC/I9=(END_HH * 3600)+(END_MM * 60) + END_SS ;
DIFF_SCNDS/I9=END_SEC -STRT_SEC;
-*CONVERT BACK TO HH MM SS
HRS_DIFF/I2L=DIFF_SCNDS /3600;
MINS_DIFF/I2L = (DIFF_SCNDS - (HRS_DIFF * 3600))/60;
SECS_DIFF/I2L = (DIFF_SCNDS - (HRS_DIFF * 3600)) - (MINS_DIFF * 60);
-* FLLIP BACK TO ALPHA; ADD IN THE (COLONS) :'S
TIMEDIFF/A8=EDIT(HRS_DIFF) | ':' | EDIT(MINS_DIFF) | ':' | EDIT(SECS_DIFF);
END
-* using the car db...
DEFINE FILE CAR
STRT_TIME/A8 ='12:02:11';
END_TIME/A8 ='14:22:22';
END
TABLE FILE CAR
PRINT STRT_TIME AS 'Starting Time:' END_TIME AS 'Ending Time:'
COMPUTE ELAPSED/A8= TIMEDIFF(STRT_TIME,END_TIME); AS 'Elapsed Time:'
COUNTRY NOPRINT
IF RECORDLIMIT EQ 1
END
You could capture the date and time before and after your task and then use date-time functions to calculate the difference in seconds. I used a -REPEAT loop as my task here in order to get a meaningful time difference between start and finish.
Originally I used HDIFF to calculate the difference for DAY, HOUR, MINUTE, and SECOND, but discovered that if the start and finish times spanned the new minute mark (e.g., 13:06:57 to 13:07:03), HDIFF was returning 1 minute for the MINUTE difference instead of zero. So I decided to take the HDIFF total seconds and use Dialogue Manager to perform the remaining calculations.
SET PAGE = NOLEAD
DEFINE FUNCTION TIMEDIFF(STRT_TIME/A8,END_TIME/A8)
-*SPLIT OUT HH MM SS; CONVERT TO 'I' FOR STRT_TIME AND END_TIME
STRT_HH/I2=EDIT(EDIT(STRT_TIME,'99'));
STRT_MM/I2=EDIT(EDIT(STRT_TIME,'$$$99'));
STRT_SS/I2=EDIT(EDIT(STRT_TIME,'$$$$$$99'));
STRT_SEC/I9=(STRT_HH * 3600)+(STRT_MM * 60) + STRT_SS ;
END_HH/I2=EDIT(EDIT(END_TIME,'99'));
END_MM/I2=EDIT(EDIT(END_TIME,'$$$99'));
END_SS/I2=EDIT(EDIT(END_TIME,'$$$$$$99'));
END_SEC/I9=(END_HH * 3600)+(END_MM * 60) + END_SS ;
DIFF_SCNDS/I9=END_SEC -STRT_SEC;
-*CONVERT BACK TO HH MM SS
HRS_DIFF/I2L=DIFF_SCNDS /3600;
MINS_DIFF/I2L = (DIFF_SCNDS - (HRS_DIFF * 3600))/60;
SECS_DIFF/I2L = (DIFF_SCNDS - (HRS_DIFF * 3600)) - (MINS_DIFF * 60);
-* FLLIP BACK TO ALPHA; ADD IN THE (COLONS) :'S
TIMEDIFF/A8=EDIT(HRS_DIFF) | ':' | EDIT(MINS_DIFF) | ':' | EDIT(SECS_DIFF);
END
DEFINE FILE CAR
STRT_TIME/A8 ='12:02:05';
END_TIME/A8 ='13:02:10';
END
TABLE FILE CAR
PRINT STRT_TIME AS 'Start Time' END_TIME AS 'End Time'
COMPUTE ELAPSED/A8= TIMEDIFF(STRT_TIME,END_TIME); AS 'Elapsed Time'
BY COUNTRY
ON TABLE SUBFOOT
"SUBFOOT: <STRT_TIME <END_TIME <ELAPSED"
ON TABLE SUBTOTAL AS 'SUBTOTAL:'
END
The above code (posted by IRA on Fri Sep 17 2010 10:04) produces this.
COUNTRY Start Time End Time Elapsed Time
ENGLAND 12:02:05 13:02:10 01:00:05
FRANCE 12:02:05 13:02:10 01:00:05
ITALY 12:02:05 13:02:10 01:00:05
JAPAN 12:02:05 13:02:10 01:00:05
W GERMANY 12:02:05 13:02:10 01:00:05
SUBTOTAL:
SUBFOOT: 12:02:05 13:02:10 01:00:05
What I need is for the "ON TABLE SUBTOTAL AS 'SUBTOTAL:'" to display the subtotals of the times. 'Elapsed Time' is 05:00:25. Or to display the time totals aligned in a SUBFOOT.
Or, a NFR which calculates time differences directly from a field which is formatted as 'HYYMDS'. This function needs to provide a result which is available in the ON TABLE or ON FIELD SUBTOTAL lines.
Let me know you thoughts and/or solution. I'll open a NFR in the meantime. Perhaps even a CASE.
Thanks in advance, DougThis message has been edited. Last edited by: Doug,
In FOCUS Since 1983 ~ from FOCUS to WebFOCUS. Current: WebFOCUS Administrator at FIS Worldpay | 8204, 8206
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005