try this, your loops are using too many conditionals. What kind of data is
this, string, integer, etc?
MONTHLY.USAGE:
--------------
CM = MONTH + LY.CNT
TEA = PARMS(12)<101,CM>
EAT = PARMS(12)<133,CM>
ATE = PARMS(12)<134,CM>
FOR M = 1 TO 12
IF TEA+EAT+ATE <> '' THEN CUM(M) = TEA+EAT+ATE
YAM = PARMS(7)<100,CM>
AMY = PARMS(7)<101,CM>
MYA = PARMS(7)<102,CM>
IF YAM+AMY+MYA <> '' THEN
IF YAM # '' THEN CUMO(M) += YAM ELSE CUMO(M) += TEA
IF AMY # '' THEN CUMO(M) += AMY ELSE CUMO(M) += EAT
IF MYA # '' THEN CUMO(M) += MYA ELSE CUMO(M) += ATE
END
CM -= 1 ; IF CM = 0 THEN CM = 24
NEXT M
RETURN
> Date: Thu, 3 Mar 2011 13:38:27 +1100
> From: [email protected]
> To: [email protected]
> Subject: Re: [U2] Is this worth rewriting?
>
> If you are running UniData, you can also move the TEA, EAT, ATE, YAM,
> AMY & MYA outside of the FOR M loop if you exclude CM. Inside you can
> than do TEACM = TEA<1,CM>, etc
>
> Of course, as stated by others, whether it is worth the changing/testing
> time cannot be known unless you have actually benchmarked this code to
> determine if it will make a meaningful difference.
>
> On the other hand, if you change it to actually make the variable
> names/code more meaningful so the next poor soul doesn't need to read in
> several times to understand it, then sure, go ahead.
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Keith Johnson
> [DATACOM]
> Sent: Thursday, 3 March 2011 11:47 AM
> To: '[email protected]'
> Subject: Re: [U2] Is this worth rewriting?
>
> Agreed that the dimensioned extract wouldn't make much difference, still
> the attributes numbers are quite high.
>
> The code below goes from 15 extracts maximum per for-next loop to 6.
> I can't help but think this might mean something if it takes 90 minutes
> to run.
>
> 001: MONTHLY.USAGE:
> 002: CM = MONTH + LY.CNT
> 003: FOR M = 1 TO 12
> 004: TEA = PARMS(12)<101,CM>
> 005: EAT = PARMS(12)<133,CM>
> 006: ATE = PARMS(12)<134,CM>
> 007: IF TEA # '' OR EAT # '' OR ATE # '' THEN CUM(M) = TEA + EAT + ATE
> 008: YAM = PARMS(7)<100,CM>
> 009: AMY = PARMS(7)<101,CM>
> 010: MYA = PARMS(7)<102,CM>
> 011: IF YAM # '' OR AMY # '' OR MYA # '' THEN
> 012: IF YAM # '' THEN CUMO(M) += YAM ELSE CUMO(M) += TEA
> 013: IF AMY # '' THEN CUMO(M) += AMY ELSE CUMO(M) += EAT
> 014: IF MYA # '' THEN CUMO(M) += MYA ELSE CUMO(M) += ATE
> 015: END
> 016: CM -= 1 ; IF CM = 0 THEN CM = 24
> 017: NEXT M
> 018: RETURN
>
>
> So I'd say AYE - or YEA, if you use meaningful variables
>
> Regards, Keith
>
> _______________________________________________
> U2-Users mailing list
> [email protected]
> http://listserver.u2ug.org/mailman/listinfo/u2-users
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email
> ______________________________________________________________________
> ###########################################################################################
> The information transmitted in this message and attachments (if any) is
> intended only
> for the person or entity to which it is addressed. The message may contain
> confidential
> and/or privileged material. Any review, retransmission, dissemination or
> other use of
> or taking of any action in reliance upon this information by persons or
> entities other
> than the intended recipient is prohibited. If you received this in error,
> please
> contact the sender and delete the material from any computer.
>
> The intended recipient of this e-mail may only use, reproduce, disclose or
> distribute
> the information contained in this e-mail and any attached files with the
> permission of IMB.
> ###########################################################################################
> _______________________________________________
> U2-Users mailing list
> [email protected]
> http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users