|
David & Eileen Keck wrote: > I was doing a little light reading in the RPG IV reference and came across > the NOOPT d-spec keyword, which befuddles me. It says we should always > specify NOOPT when prototyping for an OPM RPG program ... that problems with > data currency "could" occur if it's not used. It also says that "some" data > may not be "current" during exception processing unless NOOPT is specified. > This keyword is defined in the manual without respect to any optimization on > any CRT* commands. This all seems very cloudy ... can anyone clear this up > for me ? Thanks - Dave K. The RPG IV Reference is "light" reading? The key words regarding this particular keyword (and optimization in general) are "may" and "might". First, I wouldn't worry about it much unless you're compiling your modules with optimization levels higher that *NONE. Second, I wouldn't worry much about using NOOPT unless some variable used in the *PSSR or an INFSR does not have the value you know it should have. Thirdly, if your application does a lot of I/O, I wouldn't worry much at all about using optimization levels higher than *NONE. Analyzing and optimizing your I/O logic will always pay off better than bumping up the optimization level in the compiler. Why might some variable not have a "current" value? There are a lot of possible optimizations that an optimizing back-end can do. One example is that if a value intended to be assigned to some variable is in a register, the back-end can refer to the value in the register instead of the value in the variable. The back-end can in some cases defer the assignment of the value to the variable to a point where the back-end knows the value has to be actually contained by the variable. But if an exception occurs in the mean-time, the value in the register would be lost. But considering how pessimistic the RPG front-end is regarding optimization, I'm not even sure if this situation would ever crop up in practice. But in case you do run into trouble with an unexpectedly aggressive optimization, you do have the option to tell the optimizer to lay off a particular variable. Cheers! Hans BTW, for light reading, try a Terry Pratchett novel instead.
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.