Well, I hadn't done this comparison in quite a few years. Perhaps as long ago 
as with VS COBOL II. I just redid it with Enterprise COBOL 3.4.1. Either I 
misremembered my previous test results, but now the code sequence for 
TRUNC(BIN) and TRUNC(OPT) with OPT(FULL) is not too bad. The difference is like 
in the 3.4.1 compiler,

TRUNC(BIN) sequence is like:
   LH R2,WS-INTEGER
   AH R2,=H'1'
   STH R2,WS-INTEGER

TRUNC(OPT) is like:
   LA R2,1(0,0)
   AH R2,WS-INTEGER
   STH R2,WS-INTEGER

I would guess the second would be just a tad faster due to only 2 memory 
references (AH/STH) versus 3 (LH/AH/STH) for the first. Even the TRUNC(STD) is 
not as bad as I vaguely recall. And that is mainly due to the need to truncate 
the result if the number of decimal digits in the result is more than is allow 
for in the PICTURE definition of the resultant variable.

I don't remember exactly what was involved, but I do remember decimal 
arithmetic instructions in the generated code.

--
John McKown 
Systems Engineer IV
IT

Administrative Services Group

HealthMarkets(r)

9151 Boulevard 26 * N. Richland Hills * TX 76010
(817) 255-3225 phone * 
[email protected] * www.HealthMarkets.com

Confidentiality Notice: This e-mail message may contain confidential or 
proprietary information. If you are not the intended recipient, please contact 
the sender by reply e-mail and destroy all copies of the original message. 
HealthMarkets(r) is the brand name for products underwritten and issued by the 
insurance subsidiaries of HealthMarkets, Inc. -The Chesapeake Life Insurance 
Company(r), Mid-West National Life Insurance Company of TennesseeSM and The 
MEGA Life and Health Insurance Company.SM

 

> -----Original Message-----
> From: IBM Mainframe Discussion List 
> [mailto:[email protected]] On Behalf Of David Andrews
> Sent: Thursday, April 12, 2012 12:24 PM
> To: [email protected]
> Subject: Re: Modernizing the BCP code ?
> 
> On Thu, 2012-04-12 at 12:45 -0400, McKown, John wrote:
> > I am constantly amazed at the amount of code generate by a simpe:
> > 
> >  ADD +1 TO WS-INTEGER.
> > 
> > when WS-INTEGER is defined as PIC S9(9) BINARY
> 
> Try defining it as COMP-5 (or compile with TRUNC(BIN)) and see if that
> improves the generated code?
> 
> -- 
> David Andrews
> A. Duda & Sons, Inc.
> [email protected]
> 
> ----------------------------------------------------------------------
> 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