|
" Hello Booth, You wrote: >Next question: Simon and others have spoken of passing in the SleepFor >value as a 5 digit value. Why isn't it passed as *HMS? the procedure >itself can add the *HMS to the current time, or whatever. The added >benefit is that then there is no issues as to how many seconds in 42 >minutes. It's partly a matter of choice. I did suggest you may wish to do that sort of thing in an earlier note. I just don't think it is appropriate because a TIME represents an instant not a duration. Part of the trouble is adequately explaining the behaviour of such a procedure. Would it derive the duration from the current time, from midnight, from noon, from the birth time of the programmer, and would that behaviour be apparent from the procedure name? However a properly designed procedure can allow the sort of calculation you wish. Assume the sleepFor() procedure expects a number of seconds to be passed. Would you like to be able to code variations on the following? * Sleep for 42 minutes C CALLP sleepFor(2520) * Sleep for 42 minutes C CALLP sleepFor(60 * 42) * Sleep for a chunk of time - hours minutes and seconds could overlay a TIME * field using a DS but I think that's yucky! C CALLP sleepFor((hours * 3600) + (minutes * 60) + seconds)) Well you can with the right prototype incantations. I leave that as an excercise for you but as a hint you should read about the CONST and VALUE keywords in regard to prototypes. (That would be in the RPG IV Reference Manual :) did I just say RTFM? Nah, couldn't be me ....) Of course you would (well I would) use named constants for the magic values, e.g., $SECS_PER_HOUR and $SECS_PER_MINUTE or some such. If you wanted a sleepFor( time ) procedure then I would still define the sleepFor( seconds ) version since that is a more standard version. Then create a sleepForTime() version which probably invokes sleepFor() after calculating the duration -- Oh how I wish for a language that can overload procedures so the correct sleepFor() would be called automatically. I could have sleepFor( seconds ), and sleepFor( time ), and sleepFor( days ), and .... and .... Hmm, what would you call such behaviour? (poly ..... This parrot wouldn't voom if you put 4 million volts through it), what language does that sound like? (at least 4 spring to mind) ..... a French one, a chatty one, an incremental derivative, and a finely ground one .... Regards, Simon Coulter. «»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«» «» FlyByNight Software AS/400 Technical Specialists «» «» Eclipse the competition - run your business on an IBM AS/400. «» «» «» «» Phone: +61 3 9419 0175 Mobile: +61 0411 091 400 «» «» Fax: +61 3 9419 0175 mailto: shc@flybynight.com.au «» «» «» «» Windoze should not be open at Warp speed. «» «»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«» +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.