× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Re: how to let my program sleep a while
  • From: "paul cunnane" <paul@xxxxxxxxxxx>
  • Date: Wed, 20 Sep 2000 09:28:28 +0100

> As usual your suggestion is best.  Much better.  Two procedures it shall
> be.  Now, (every body skips over the easy stuff!) why do I want to use
>
> "CallP   Sleepfor('00:30:00')"
>
> instead of
>
> "Call   'SleepFor'"
> "Parm   '00:30:00'    Parm8       8"
>
> I understand that for most of you this is pretty basic, but hey, I just
> don't know the answer.

To eliminate the redundant PARM8 work variable from the program.  Also, to
eliminate a redundant line of code (PARM), to potentially allow inline
expressions in the call, to easily allow for literals or figurative
constants, and so on.

Maybe the most important reason: using the prototyped call allows the
compiler to check the types of the arguments you are passing to the
procedure, and signal an error at compile time rather than run time if you
try to use invalid arguments.

Finally, a prototyped call will allow the procedure to return a value,
enabling code like

  if      SleepFor('00:30:00') = WOKENUP

rather than

  call    'SleepFor'
  parm    '00:30:00'     Parm8      8
  parm                   Result     1
  if      Result = WOKENUP

(This assumes that the sleep routine allows a premature wakeup, perhaps
using the data queue technique that Albert York suggested.)

The result: two work variables and three lines of code eliminated, plus
compile-time parameter type checking.

--
Paul


+---
| 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 thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 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.