Focal Point Banner


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.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Challenge (time conversion, dialog mgr) [CODE]

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Challenge (time conversion, dialog mgr) [CODE]
 Login/Join
 
Virtuoso
posted
Given a Dialog Manager variable &TIME containing the time of day (in 24-hour clock format, 'hh:mm:ss')

Convert the time to 'Seconds Elapsed Since Midnight', in two lines of Dialog Manager code not exceeding 80 characters in length.

This message has been edited. Last edited by: j.gross,


- Jack Gross
WF through 8.1.05
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Expert
posted Hide Post
I'm sure there is a better way, but ...
-SET &SECS=ATODBL(EDIT(&TIME,'99'),2,'D2')*3600+
-ATODBL(EDIT(&TIME,'$$$99'),2,'D2')*60+ATODBL(EDIT(&TIME,'$$$$$$99'),2,'D2');


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Expert
posted Hide Post
Not necessarily better but this is a method using the current time (line length is 72 chars) -

-SET &Secs=HDIFF(HGETC(8,'HYYMDS'),HMIDNT(HGETC(8,'HYYMDS'),8,'HYYMDS'),
-    'SECOND','I9');

T



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 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Virtuoso
posted Hide Post
My attempt to solve this challenge:
-SET &SEC = HDIFF(HINPUT(20, '2009/01/01 &TIME.EVAL', 8, 'HYYMDS'),
- HINPUT(20, '2009/01/01 00:00:00', 8, 'HYYMDS'), 'SECOND', 'I7');


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report This Post
Virtuoso
posted Hide Post
Here's what I had in mind:

-SET &TIME=HHMMSS('A8');

-SET &ELAPSED=EDIT(&TIME,'99*3600 + $99*60 + $99');
-SET &ELAPSED=&ELAPSED.EVAL;


which gives, successively,
 &TIME         = 05.42.43
 &ELAPSED      = 05*3600 + 42*60 + 43
 &ELAPSED      = 20563


- Jack Gross
WF through 8.1.05
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Virtuoso
posted Hide Post
Were you very much disappointed with the results we gave you?
Did we fail some kind of test or loose points or maybe even the opposite? Confused

Anyway, your solution is quite elegant and it goes to show that there is more than one way to 'defur a feline'. Wink


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report This Post
Virtuoso
posted Hide Post
quote:
'defur a feline'



I love it!...so much more humane than the usual saying.
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Report This Post
Expert
posted Hide Post
Good One gamp.
i think this was just the brain teaser of the day... what a fun idea...




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Virtuoso
posted Hide Post
It all started when I reported to this assignment, poked around in the common code module for calculating run duration, and said to myself -- good idea, but there has to be a more succinct way of implementing the calculations...

But it does go to show that .EVAl is more than a necessary nuisance.


Anyway, here's how I would do it (wrapped in an illustrative test bed):

-REPEAT TEST FOR &J FROM 1 TO 3 ;
-*
-*--------------------------------------
** prolog: 
-SET &time1=HHMMSS('A8');
-*--------------------------------------

-TEST: SET &time1=DECODE &J (2 '01:01:01' 3 '22.58.59' ELSE '&time1.EVAL');
-*
** body
SLEEP 2
-*
-*--------------------------------------
** epilog: 
-RUN 
-SET &time2=HHMMSS('A8');
-* calculate difference  between &time1 and &time2 in seconds.
-* [3600 sec.=an hour, 86400 sec.=a day]
-SET &sec1=EDIT(&time1,'(99*3600)+$(99*60)+$(99)');
-SET &sec1=&sec1.EVAL;
-SET &sec2=EDIT(&time2,'(99*3600)+$(99*60)+$(99)');
-SET &sec2=&sec2.EVAL;
-* calculate elapsed seconds. 
-* adjust if negative (as when job overlaps midnight)
-SET &sec =IMOD((&sec2-&sec1)+86400,86400,'I5');
-* format elapsed time for display.
-SET &elapsed=1000000 +10000*INT(&sec/3600) +100*IMOD(INT(&sec/60),60,'I2L') +IMOD(&sec,60,'I2L');
-SET &elapsed=EDIT(&elapsed, '$99:99:99');
-TYPE
-TYPE <*> Start=&time1, End=&time2, Elapsed=&elapsed (&sec seconds) <*>
-TYPE
-*--------------------------------------

-TEST


Output:
 <*> Start=10.53.02, End=10.53.04, Elapsed=00:00:02 (2 seconds) <*>
 <*> Start=01:01:01, End=10.53.06, Elapsed=09:52:05 (35525 seconds) <*>
 <*> Start=22.58.59, End=10.53.08, Elapsed=11:54:09 (42849 seconds) <*>


- Jack Gross
WF through 8.1.05
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Challenge (time conversion, dialog mgr) [CODE]

Copyright © 1996-2020 Information Builders