Schumacher, Otto wrote:
We force Trunc(STD) for all programs in CICS. We have not had any
reported problems.
Yikes! The most dangerous of all the choices! That
says truncate the data to the picture, not the
actual size. It adds extra code and can truncate
significant digits with no warning.
05 FLDA PIC S99 COMP
(Yields halfword binary integer, which can hold
-9,999 to +9,999 in COBOL or -32,768 to +32,767
as far as the hardware is concerned)
MOVE +125 TO FLDA
** FLDA now contains 25 **
Regards
Otto Schumacher
Technical Support, CICS
EDS, an HP Company
Ahold Account
2000 Wade Hampton Blvd.
LC1-302
Greenville, South Carolina, 29615
Tel: 864 987-1417
Fax: 864 987-4500
E-mail: [email protected]
We deliver on our commitments
so you can deliver on yours.
-----Original Message-----
From: IBM Mainframe Discussion List [mailto:[email protected]] On
Behalf Of Rick Arellanes
Sent: Friday, May 01, 2009 12:29 PM
To: [email protected]
Subject: Re: Enterprise COBOL code generation question
On Fri, 1 May 2009 08:38:59 -0500, Chase, John <[email protected]>
wrote:
-----Original Message-----
From: IBM Mainframe Discussion List On Behalf Of Farley, Peter x23353
-----Original Message-----
From: IBM Mainframe Discussion List On Behalf Of Clark Morris
<Snipped>
On 30 Apr 2009 13:00:02 -0700, in bit.listserv.ibm-main you wrote:
Try TRUNC(OPT). Trunc STD would require the conversion to decimal
to
guarantee that the data fit the picture. TRUNC(BIN) is known and
documented to generate less than optimal code.
Son of a gun, that did it. From half a page of code to six
instructions.
I will have to test this program with TRUNC(OPT) pretty carefully to
make sure it has no other adverse affects. The doc on OPT is pretty
clear in its warnings.
And the doc on TRUNC(BIN) does have the phrase "... you can avoid the
performance overhead of using TRUNC(BIN) ...", implying there is, in
fact, a performance penalty for using it.
Thanks for pointing out the benefit of TRUNC(OPT) to me.
But then there's this in the "Notes" for TRUNC in the Installation &
Customization Guide:
" 2. TRUNC=BIN is the recommended option when interfacing with other
products that have S/390-format binary data (such as CICS, DB2,
FORTRAN,
and PL/I). This is especially true if there is a possibility of having
more than 9 digits in a fullword or more than 4 digits in a halfword."
So, we're stuck with TRUNC(BIN) in CICS, where arguably we'd want the
"best" performance. :-(
-jc-
It looks like we may have missed an update to the Customization Guide.
Please
see the Programming Guide, which was updated to say:
Recommendations: TRUNC(BIN) is the recommended option for programs that
use binary values set by other products. Other products, such as IMS,
DB2,
C/C++, FORTRAN, and PL/I, might place values in COBOL binary data items
that do not conform to the PICTURE clause of the data items. You can use
TRUNC(OPT) with CICS programs as long as your data conforms to the
PICTURE clause for your BINARY data items.
You might want to read the Enterprise COBOL Version 3 Release 1
Performance
Tuning Paper at: http://www.ibm.com/software/awdtools/cobol/library/ to
read more about this. It says:
As long as your usage of all binary (COMP) data items in the application
conforms to the PICTURE and USAGE specifications, you can use TRUNC(OPT)
to improve transaction response time. This is recommended in performance
sensitive CICS applications. If your usage of any binary data item does
not
conform to the PICTURE and USAGE specifications, you can either use a
COMP-
5 data type or increase the precision in the PICTURE clause instead of
using
the TRUNC(BIN) compiler option. Note that the CICS translator does not
generate code that will cause truncation and the CICS co-processor uses
COMP-5 data types which does not cause truncation. If you were using
NOTRUNC with your OS/VS COBOL programs without problems, TRUNC(OPT) on
IBM Enterprise COBOL behaves in a similar way. For additional
information on
the TRUNC option, please refer to the compiler options section of this
paper.
Rick Arellanes (IBM COBOL Development and Performance)
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html
--
Kind regards,
-Steve Comstock
The Trainer's Friend, Inc.
303-393-8716
http://www.trainersfriend.com
z/OS Application development made easier
* Our classes include
+ How things work
+ Programming examples with realistic applications
+ Starter / skeleton code
+ Complete working programs
+ Useful utilities and subroutines
+ Tips and techniques
==> Check out the Trainer's Friend Store to purchase z/OS <==
==> application developer toolkits. Sample code in four <==
==> programming languages, JCL to Assemble or compile, <==
==> bind and test. <==
==> http://www.trainersfriend.com/TTFStore/index.html <==
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html