|
The longest time factor I had in using subprocedures was allowing huge
strings. And it specifically had to do with using XLATE. My subprocedure
would capitalize up to a 32,000 byte string. I ended up using inline code.
However, I suspect that if the variables were the same size and only as
large as necessary my time would have been much, much shorter.
You said 26 times faster. I experienced 22 times faster. We're pretty
close there fella.
Rob Berendt
--
"They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety."
Benjamin Franklin
"Bob Cozzi
\(RPGIV\)" To: <rpg400-l@midrange.com>
<cozzi@rpgiv.com> cc:
Sent by: Fax to:
rpg400-l-admin@mi Subject: RE: Divide by zero
monitoring
drange.com
03/04/2002 04:25
PM
Please respond to
rpg400-l
Let's not forget, that there is overhead involved in calling a
procedure!
I ran a test using the XLATE operation in my TOUPPER()
procedure/function. It took 26 times longer to run the code in a
procedure than it did as in-line code. Now, that's a couple lines of
code vs a procedure wrapper for that same few lines of code. Of course
if you put 100 lines of code into a procedure, the overhead isn't going
to increase, it'll stay the same.
Until IBM adds a "Inline" keyword to procedures, use of procedures for
certain time-critical things (like math) might be better left on the
wish list.
Specs:
Called the procedure 30000 times
vs.
Inline XLATE and SUBST opcodes.
Procedure was approximately 14.17 units of measure.
Inline code was 0.02 units of measure.
So the overhead for a procedure call is X where X = approx. 13.8 units
of measure regardless of the size of the procedure.
Bob Cozzi
cozzi@rpgiv.com
Visit the on-line Midrange Developer forum at: http://www.rpgiv.com
> -----Original Message-----
> From: rpg400-l-admin@midrange.com [mailto:rpg400-l-admin@midrange.com]
On
> Behalf Of Reeve Fritchman
> Sent: Monday, March 04, 2002 2:58 PM
> To: rpg400-l@midrange.com
> Subject: RE: Divide by zero monitoring
>
> This is a great application for a subprocedure: EVAL RESULT =
> DIVIDE(FACTOR1:FACTOR2)
>
> -----Original Message-----
> From: rpg400-l-admin@midrange.com
[mailto:rpg400-l-admin@midrange.com]On
> Behalf Of jpcarr@tredegar.com
> Sent: Monday, March 04, 2002 3:44 PM
> To: rpg400-l@midrange.com
> Subject: Re: Divide by zero monitoring
>
>
> Ya, you have to test for it
>
>
> C IF (TOT <> 0)
> C EVAL(H) PARR(OC) = ((PTRUNHR/TOT) * 100)
> C ELSE
> C EVAL PARR(OC) = 0
>
> John Carr
>
> ---------------
> For the EVAL statement, is there a way to monitor for divide by zero
> errors?
> We just want to ignore the statement then continue on. Or will I have
to do
> an ol' fashioned IF statement?
>
> Thanks,
>
>
> _______________________________________________
> This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list
> To post a message email: RPG400-L@midrange.com
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l
> or email: RPG400-L-request@midrange.com
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/rpg400-l.
>
>
> _______________________________________________
> This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list
> To post a message email: RPG400-L@midrange.com
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l
> or email: RPG400-L-request@midrange.com
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/rpg400-l.
_______________________________________________
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l
or email: RPG400-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.