On 2017-08-04 07:56, Robert Prins wrote:
On 2017-08-04 00:31, Charles Mills wrote:
Certainly if one is looking to save a cycle or two then
if a(i) >= 0 then
sum = sum + a(i);
should be
if a(i) > 0 then
sum = sum + a(i);
because adding a(i) to sum when a(i) == 0 is a waste of a cycle or two.
Yes, but in this case it *IS* significant, because the initialization of a PL/I
"FIXED (7)" with -1.0 < init-value < 0 will set it to MINUS zero (zero with a
D-sign) and by adding zero to this will normalize the value to have a C-sign.
As I already write in the title, the gal or guy who wrote this code is just a
trifle too smart for her or his own good, I've been using PL/I for nearly 32
years, and until I used UNSPEC() on "sum", the code didn't make any sense to me.
FWIW, my original post contained a type,
if substr(unspec(sum), 25, 8) ^= '0d'bx then
should have been
if substr(unspec(sum), 29, 4) ^= 'd'bx then
or, like in the original code,
if substr(unspec(sum), 8*stg(sum)-3, 4) ^= 'd'bx then
Mea culpa, too much Intel assembler where hex constants must start with a
zero...
Following myself, I've submitted this RFE requesting an I- or W-type message to
flag this kind of (too) clever code, or a new RULES() option to outright ban it
with an E-type message:
http://www.ibm.com/developerworks/rfe/execute?use_case=viewRfe&CR_ID=108713
Robert
--
Robert AH Prins
robert.ah.prins(a)gmail.com
Some programming @ <https://prino.neocities.org/zOS/zOS%20Tools.html>
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN