Anonymous user
DELAY.REX: Difference between revisions
m
added a comment concerning fractional seconds.
(→{{header|REXX}}: delay time for Regina now supports fractional seconds.) |
m (added a comment concerning fractional seconds.) |
||
(5 intermediate revisions by the same user not shown) | |||
Line 16:
<br>Note: when PC/REXX or Personal REXX are used, those REXXes already have a built-in function (BIF), so the '''delay''' subroutine (below) will never be executed, but the REXX '''DELAY''' BIF will be used instead.
=={{header|REXX}}==
<lang rexx> select▼
trace off /*suppress any REXX error messages. */▼
parse arg ! /*obtain all the arguments from the CL.*/▼
▲ select
when !cms then @cpsleep n "SEC" /*Is this CMS? Use CP SLEEP. */
when !tso then call sleep n /*Is this TSO? Use SLEEP cmd. */
when !regina then do /*Is this Regina? */
if nFrac=n then call sleep n /*whole seconds? */
else call beep
/* [↑] sound MAY be heard, faint tic.*/
end
when !dos then @ping @pingArgs /*Is this DOS?
otherwise nop /*don't know what this environment is.*/
end /*select*/
/*══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════*/
Line 85 ⟶ 52:
syntax: !sigl=sigl; call er 13, !fid(2) !fid(3) !sigl !cal() condition('D') sourceline(!sigl)</lang>
Coding note: the '''!<small>xxx</small>''' subroutines (above) deal mostly with determining what version of REXX is being invoked and what operating system is being used; and based on that information, appropriate flags (variables) are set. This is an example of a robust boilerplate code checking for various versions of REXX and operating systems, and it also defines additional flags not used within this particular program.
Programming note: The subroutine '''$ERR''' isn't included here; so here is the gist of the error messages:
::* '''er 59''' too many arguments specified for the ─── DELAY ─── command.
::* '''er 53''' argument ─── xxx ─── isn't numeric for the option ─── delay-seconds ─── for the ─── DELAY ─── command.
|