OK, I get it. (Way too much time spent on this now.) The sum is also to be printed if there are any zero values in a[whatever].
Is this a real business problem or an exercise in whatever? I don't know the PL/I compiler but on a modern processor Store on Condition potentially makes if a(i) >= 0 then switch = 1; pretty fast. Charles -----Original Message----- From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf Of Charles Mills Sent: Friday, August 4, 2017 6:24 AM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: Someone just too smart for his or her own good? Oh geez, well then I rest my case that this code is too clever to be maintainable. The next programmer might not be any smarter than I. (I'm not a PL/I expert -- I guess "fixed" means packed? I had guessed binary.) If i is fairly large and there are a good number of a(i) == 0 then my point is still valid -- this has to be an expensive way of doing this. What is the statement of the problem? What is the snippet supposed to accomplish? "For a table of packed values a[whatever], print the sum of all of the positive values, unless that sum is zero?" Do I have that right? I would be stunned if the code below performs better than -- and not worse than, assuming a fair number of zero values -- the most obvious logic for i = 1 to whatever; if a(i) > 0 then sum = sum + a(i); end; if sum > 0 then put data(sum); Charles ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN