Re: TRUNC(BIN) and COMP-5
- From: "Sergey Kashyrin" <ska@xxxxxxxxxxx>
- Date: Mon, 29 Oct 2007 15:39:14 -0400
Further adding to the mystery, this example says TRUNC(OPT) turns the
mainframe into a
little-endian machine.
:-))
They are simply wrong.
"Robert" <no@xxxxxx> wrote in message
news:ghd9i31ouuucrujojivbmm8e24bo7cgee4@xxxxxxxxxx
On Sat, 27 Oct 2007 22:18:58 GMT, "William M. Klein"
<wmklein@xxxxxxxxxxxxxxxxx> wrote:
I realized that I made one mistake in my reply to RW.
COMP-5 and COMP with TRUNC(BIN) perform identically. The advantage of
COMP-5 is
that you can use the TRUNC(OPT) compiler option which will impact all
"normal"
COMP and BINARY fields. You only need to use COMP-5 for fields that MAY
contain
data larger than the picture clause. (All of this applies to IBM
Enterprise
COBOL - any release and NOT to COMP-5 in other implementations).
To summarize,
For IBM Enterprise COBOL, COMP-5 is a "content of field" USAGE and is
not
documented as a "performance" USAGE. It is documented as SLOWER than
using
COMP/BINARY with TRUNC(OPT) in most cases. See:
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/igy3pg32/2.4.54
which states,
"USAGE COMP-5 has the effect of applying TRUNC(BIN) behavior to individual
data
items. Therefore, you can avoid the performance overhead of using
TRUNC(BIN) for
every binary data item by specifying COMP-5 on only some of the binary
data
items, such as those data items that are passed to non-COBOL programs or
other
products and subsystems. The use of COMP-5 is not affected by the TRUNC
suboption in effect. "
I naively thought THE MACHINE would be used to truncate a value to word
size. For example,
I thought ADD A B GIVING C would generate
L R5,A
A R5,B
ST R5,C
Evidently, IBM has to call a function to insure a 32 bit register doesn't
contain more
than 32 bits of data. :) They COULD have done it with an inline
N R5,=X'FFFFFFFF' Do nothing instruction
Further adding to the mystery, this example says TRUNC(OPT) turns the
mainframe into a
little-endian machine.
http://tinyurl.com/yt62pa
.
- References:
- TRUNC(BIN) and COMP-5
- From: William M. Klein
- Re: TRUNC(BIN) and COMP-5
- From: Robert
- TRUNC(BIN) and COMP-5
- Prev by Date: Re: COBOL to Java conversion
- Next by Date: Re: Data validation (NUMERIC checking follow-on)
- Previous by thread: Re: TRUNC(BIN) and COMP-5
- Next by thread: Re: TRUNC(BIN) and COMP-5
- Index(es):
Relevant Pages
|
|