|
But aren't you required to write those same lines as PR lines in the D-specs? The line or two of code you saved in the C-spec (where the action is) aren't really saved but are moved far away to the D section? _______________________ Booth Martin Booth@MartinVT.com http://www.MartinVT.com _______________________ "paul cunnane" <paul@cunnane.net> Sent by: owner-rpg400-l@midrange.com 09/20/2000 04:28 AM Please respond to RPG400-L To: <RPG400-L@midrange.com> cc: Subject: Re: how to let my program sleep a while > 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 +--- +--- | 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-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.