I've been pondering the TRUNC option since yesterday.  Let me ask this 
question...  Is the only time the TRUNC option come in to effect when one 
binary field is moved to another, smaller, binary field?  Because it appears if 
a packed-decimal or zoned decimal field is moved in to a smaller binary field 
the TRUNC(STD) logic is always performed.  Specifically, the sending field is 
moved to a temp field, it is then truncated, and then converted to binary.  At 
least in the examples I've tried.

If that's the case I think I'll just stay with TRUNC(STD) since situations 
where TRUNC(OPT) would come in to play would be rare enough anyway that there 
would be no noticeable gain, and too much to lose.  I can't think of many cases 
where someone would move a "large" binary field to a smaller one anyway.

Personally, I think "picture defined" COMP/BINARY fields should be eliminated 
in favor of the COBOL 2002 BINARY-SHORT (halfword), BINARY-LONG (fullword) and 
BINARY-DOUBLE (doubleword) data types, which make much more sense in the real 
world anyway.  (of course eliminating the legacy data types is never going to 
happen, because its too ingrained.)

Thanks,
Frank



________________________________
 From: Tom Ross <tmr...@stlvm20.vnet.ibm.com>
To: IBM-MAIN@LISTSERV.UA.EDU 
Sent: Friday, September 26, 2014 10:51 AM
Subject: Re: COBOL 5 compile options
 

>Thanks Tom!
>For HGPR, don't you mean the reverse of what you said?  PRESERVE would alwa=
>ys be save because COBOL preserves and restores the high-halves of the regi=
>sters, right?  Safer, but not as efficient?

Ooops, at least I was 100% wrong :-)  Yes, PRESERVE is safer, although
NOPRESERVE might be safe for most as well.

>As for NUMPROC, thanks for the info.  Seems to me the documentation could b=
>e made clearer, though I don't know exactly all.  In the end I can't imagin=
>e doing what you suggest, even though "it's the only way to be sure".  So w=
>e'll probably, unfortunately, just go with NOPFD.  But thanks a lot for the=
> info!!

Yes, I was aware that my idea was kind of crazy, and eve asked at SHARE if
anyone could ever do such a thing.  On the other hand, if you did not find out
if your data has preferred signed and chose PFD, you could get silent death ;-)

>Question about one additional option.  We use TRUNC(STD) right now.  What w=
>ould be have to be aware of if we wanted to switch to TRUNC(OPT) (where I a=
>ssume OPT =3D "optimize")?  Is OPT fully compliant with COBOL standard trun=
>cation rules?

TRUNC(OPT) does not result in any code generated to truncate.  it is NOT
COBOL Standard conforming and neither is TRUNC(BIN).  You could get more
accurate results with TRUNC(OPT) (along with much better performance) but
I know that for many customers 'more accurate' = 'different' = BAD :-)

Cheers,
TomR              >> COBOL is the Language of the Future! <<

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to