It is the unnecessary nested'if' that would degrade performance:
for i = 1 to whatever;
if a(i) >= 0 then /* <-- if #1 */
if sum ^= -1 then /* <-- if #2 */
sum = sum + a(i);
else
sum = a(i);
end;
if substr(unspec(sum), 25, 8) ^= '0d'bx then
put data(sum);
It would be more efficient (less machine code) if coded as:
for i = 1 to whatever;
if a(i) > 0 then
sum = sum + a(i);
end;
if substr(unspec(sum), 25, 8) ^= '0d'bx then
put data(sum);
CP
On 04/08/2017 01:32, Charles Mills wrote:
> for i = 1 to whatever;
> if a(i) >= 0 then
> if sum ^= -1 then
> sum = sum + a(i);
> else
> sum = a(i);
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN