Charles.   PL/1 and REXX are about the same   The break would be a goto 

Sent from my iPhone

Sorry for any grammar problems 

> On Aug 4, 2017, at 12:45, Charles Mills <[email protected]> wrote:
> 
> Why do I keep devoting thought to this?
> 
> If you desperately needed to optimize every last cycle out of the loop, and 
> you wanted to do this in a supported way, the trick would be two loops. 
> Something like
> 
> for i = 1 to whatever;
>  if a(i) >= 0 then do
>    sum = sum + a(i);
>    switch = 1;
>    break? /* what is the PL/I to exit from a loop? */ ;
>  end;
> end;
> 
> for i = i to whatever;
>  if a(i) > 0 then sum = sum + a(i);
> end;
> 
> I'm not a PL/I coder so not sure if you need a test for i already == whatever 
> when it gets to the second loop or whether it has already been incremented, 
> etc. 
> 
> Probably faster than the original because avoids most of the a(i) == 0 cases.
> 
> Charles
> 
> 
> -----Original Message-----
> From: IBM Mainframe Discussion List [mailto:[email protected]] On 
> Behalf Of Robert Prins
> Sent: Friday, August 4, 2017 10:48 AM
> To: [email protected]
> Subject: Re: Someone just too smart for his or her own good?
> 
>> On 2017-08-04 13:41, Charles Mills wrote:
>> 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?
> 
> The original code actually fills a set of buckets with values (or nothing), I 
> just simplified the code to a loop over an array, changing the values in the 
> array to do some testing, after first figuring out what was going on.
> 
>> 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;
> 
> It's more than likely that Enterprise PL/I V5.2 can already generate code 
> that utilizes new features of the z14 systems.
> 
> Robert
> --
> Robert AH Prins
> robert.ah.prins(a)gmail.com
> 
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions, send email to 
> [email protected] with the message: INFO IBM-MAIN
> 
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to [email protected] with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to