|
Ð Hello Booth, You wrote: >Would this question be an example of where someone should write a >Procedure (or whatever its called) named "Sleep" with a parm for >sleeptime(*HMS) and then everyone in that organization would for evermore >only need to write: > C CallP Sleep('00:30:00') >and have the application sleep for 30 minutes? >And if so, is the procedure thingy hard to code and put in place? Couldn't be simpler. The most trivial approach is simply to prototype the C (well, Eunuchs really) sleep() function and bind to QC2LE. D sleep PR 10I 0 EXTPROC('sleep') D seconds 10U 0 VALUE If you need a more granular timer than sleep, which resolves to seconds, you can prototype usleep() which resolves to microseconds (although that should be replaced with the Posix function setitimer() and appropriate signal handling). D sleep PR 10I 0 EXTPROC('usleep') D useconds 10U 0 VALUE but if you really wanted to do it yourself you'ld create a prototype: D sleep PR D sleepTime 6P 0 CONST and then write the code: D sleep B EXPORT D sleep PI D sleepTime 6P 0 CONST /copy rpgleinc,qcmdexc D EVAL cmd = 'DLYJOB DLY(' + %CHAR(sleepTime) + ')' D CALLP runCmd( cmd : %LEN(%TRIMR(cmd)) ) D RETURN D sleep E Which, of course, is merely one possible approach to the problem. Shove the sleep routine in a service program and Bob's your Mother's brother -- you should, of course, create a source member with the appropriate binding source to e.g., STRPGMEXP *CURRENT EXPORT(sleep) ENDPGMEXP All that the users of the function need to do is include the prototype (so shove that in a copy member), invoke sleep( some-value ), and bind to the service program for the magic to happen. Dah da da dah da daaaah! Caveat: Coded on the fly therefore untested! 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.