-TYPE -TYPE Report elapsed time: &ELAPSED_M mins &ELAPSED_R secs
For convenience, put the two pieces of code into fexes that you -INCLUDE into your report program.
August 23, 2004, 08:55 PM
RB
Hi Pietro,
Second one works well. I do not think &variables are giving the right time. Thank you for the solution.
I have one more idea that works.
Include this at the beginning of the program -SET &STARTIME = HHMMSS(STIME); -TYPE &STARTIME
Include this at the end of the program -SET &ENDTIME = HHMMSS(ETIME); -TYPE &ENDTIME
August 24, 2004, 02:36 PM
Tom Walker
How about this variation...
-SET &BEGTIME = HGETC(10,'HYYMDm'); -RUN
TABLE FILE ... etc etc
-SET &ENDTIME = HGETC(10,'HYYMDm'); -SET &SECS = HDIFF(&ENDTIME, &BEGTIME, 'SECOND', D12.2); -SET &MILSEC = HDIFF(&ENDTIME, &BEGTIME, 'MILLISECOND', D12.2); -TYPE Execution time in seconds = &SECS -TYPE Execution time in mili-seconds = &MILSEC -EXIT
August 24, 2004, 03:46 PM
susannah
so cool to know, kudos and thanks rb and tom. I'd been using &tod and suffering. This is great
August 24, 2004, 05:16 PM
<Pietro De Santis>
Tom, thanks for your suggestion, nice and clean.
August 24, 2004, 06:54 PM
RB
Thank you Tom. It never stuck to me that we can DIFF functions for the difference.
August 24, 2004, 07:36 PM
Tom Walker
I get a lot of date-time formatting tips from the presentation Renee Teatro gave in New Orleans titled, "That's not a date-time datatype, is it?". The link for the power point presentations is
Include this at the beginning of the program -SET &STARTIME = HHMMSS(STIME); -TYPE &STARTIME
Include this at the end of the program -SET &ENDTIME = HHMMSS(ETIME); -TYPE &ENDTIME
But it looks like it is not working. The start time is the same as the end time. I have a long report that when I time it using a stopwatch takes about 2 mins.
Am I missing something?
Thanks, Dan
Dev: WebFOCUS 7.6.10, Data Migrator 7.6.10 QA: WebFOCUS 7.6.10, Data Migrator 7.6.10 Prod: WebFOCUS 7.6.2, Data Migrator 7.6.8 Windows 2K3, Tomcat 5.5.17, IIS 6 Usage: HTML, PDF, Excel, Self-serve, BID and MRE
May 02, 2006, 02:22 PM
dwf
Possibly. Be sure you have a -RUN after the END statement of your TABLE FILE (and before the last -SET &ENDTIME). Otherwise, both the times will be captured before the report runs.
I'm now able to see the ENDTIME after I remove the -RUN command on the TABLE FILE before it. Thanks for all the help!
Dan
Dev: WebFOCUS 7.6.10, Data Migrator 7.6.10 QA: WebFOCUS 7.6.10, Data Migrator 7.6.10 Prod: WebFOCUS 7.6.2, Data Migrator 7.6.8 Windows 2K3, Tomcat 5.5.17, IIS 6 Usage: HTML, PDF, Excel, Self-serve, BID and MRE
May 03, 2006, 03:54 AM
Tony A
Dan,
One of the bugbears that has always been commented upon is the fact that &TOD has always been set to the time at which the FOCUS session began. Over time this has become to be viewed as an asset because, combined with the HHMMSS function you can get that elapsed timing you require.
Taking advantage of the above facts, you can declare a function in your profile(s) that will then always be available -
-* Calculate seconds between final and initial time.
DEFINE FUNCTION ELAPSED(X/A1)
DAY/YYMD = HDATE(TODAY('A10'),'YYMD');
DATE/A6YMD = DAY;
BEGTIME/A8 = EDIT('&TOD.EVAL', '99$:99$:99');
ENDTIME/A8 = EDIT(HHMMSS('A8'), '99$:99$:99');
BEGAN/A20 = DATE | ' ' | BEGTIME;
ENDED/A20 = DATE | ' ' | ENDTIME;
-* Convert to time stamps
DATE_TIME1/HYYMDSA=HINPUT(20,BEGAN,10,'HYYMDS');
DATE_TIME2/HYYMDSA=HINPUT(20,ENDED,10,'HYYMDS');
-*Subtract the two time stamps, getting difference in seconds
ELAPSED/D12.2=HDIFF(DATE_TIME2, DATE_TIME1, 'SECOND', 'D12.2');
END
-RUN
-* The RUN is important to ensure that the define is actioned immediately and therefore available
-* when required.
Then when you want to access the elasped time, just set a variable to the function output value -
-* Find elapsed time
-SET &ELAPSED = ELAPSED('X');
This will cover all your elapsed timing needs (or should do?).
TThis message has been edited. Last edited by: Tony A,
In FOCUS since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2
WebFOCUS App Studio 8.2.06 standalone on Windows 10