|
If you are trying to set a never ending loop then why not just dou 'cat'= dog' ? Its immediately clear to anyone what you are doing. This *HIVAL thing doesn't have "forever" written all over it, and would cause anyone that sees it the first time to find the field's *HIVAL and ask questions. For instance, look at the amount of confusion and discussion it has generated here. Something similar must happen with every programmer that sees this technique for the first time. Besides that, why have a never ending loop? I thought goto, leave, iter, CAS**, and CAB** were all opcodes that had been disgraced and sent into exile? --------------------------------------------------------- Booth Martin http://www.MartinVT.com Booth@xxxxxxxxxxxx --------------------------------------------------------- -------Original Message------- From: RPG programming on the AS400 / iSeries Date: 11/21/2003 10:47:01 AM To: rpg400-l@xxxxxxxxxxxx Subject: Re: Infinit loop in /free Steve Richter wrote: > well I just had to test this ( comparing a count to a 31 digit packed > decimal hival number seems a bit wasteful ) ... > > the following million iteration loop runs for 63 milliseconds on a 170/2386 > ( 400+ cpw ): > ... > > and this do *hival version runs for 390 milliseconds > ... > > -Steve > So this means that in a loop that does nothing, a DOW loop is preferable to DO *HIVAL. In practice, most loops do a bit more than that, and so the difference in loop overhead is usually swamped by the operations within the loop. But the comparison itself is flawed. The former uses a 10I0 variable as loop index, the latter uses an implicitly defined decimal variable with a precision of 31 digits. To make the comparison fair, define IX as 31P0 in the first program. Out of curiosity, let's examine this result further. For the latter program, "DO *HIVAL" runs about 3 million iterations per second. If we let the program run for *HIVAL iterations, how long will we have to wait for the loop to end? My calculations show we'll have to wait, oh, about a hundred million billion years. ;-) Cheers! Hans
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.