In PL/I "FIXED" means neither packed nor binary; it can be either.  The
relevant attribute is "DEC" or "BIN" (short forms), and the default is
"DEC".

Using UNSPEC to test the sign is absolutely ridiculous.  Sure, that's "too
clever", but it really shows that the writer was a wanker.  Nevertheless,
you have no case for an RFE.  Any feature can be abused or misused.

Anyway, it's been really difficult to make out what this post is about.
What's with all the discussion about what's in the loop, "negative zero",
etc. if the UNSPEC is the issue?

sas

On Fri, Aug 4, 2017 at 9:42 AM, Charles Mills <charl...@mcn.org> wrote:

>
> -----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

Reply via email to