compiler option



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

compiler option

Postby kumarshiva » Thu Oct 07, 2010 7:35 am

what is the purpose of compiler option TRUNC(OPT)
kumarshiva
 
Posts: 7
Joined: Thu Oct 07, 2010 7:30 am
Has thanked: 0 time
Been thanked: 0 time

Re: compiler option

 

Re: compiler option

Postby Robert Sample » Thu Oct 07, 2010 7:49 am

The COBOL Programming Guide says
TRUNC(OPT)
TRUNC(OPT) is a performance option. When TRUNC(OPT) is in effect, the compiler assumes that data conforms to PICTURE specifications in USAGE BINARY receiving fields in MOVE statements and arithmetic expressions. The results are manipulated in the most optimal way, either truncating to the number of digits in the PICTURE clause, or to the size of the binary field in storage (halfword, fullword, or doubleword).

Tips:

* Use the TRUNC(OPT) option only if you are sure that the data being moved into the binary areas will not have a value with larger precision than that defined by the PICTURE clause for the binary item. Otherwise, unpredictable results could occur. This truncation is performed in the most efficient manner possible; therefore, the results are dependent on the particular code sequence generated. It is not possible to predict the truncation without seeing the code sequence generated for a particular statement.

* There are some cases when programs compiled with the TRUNC(OPT) option under Enterprise COBOL could give different results than the same programs compiled under OS/VS COBOL with NOTRUNC. You must actually lose nonzero high-order digits for this difference to appear.
And the real question is, why are you not reading the manual yourself to find this out? A professional career in IT requires the ability to research independently and figure out things on your own -- which means you need to know how to read manuals.
Robert Sample
Global moderator
 
Posts: 3376
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 224 times

Re: compiler option

Postby kumarshiva » Thu Oct 07, 2010 8:13 am

Thanks for the response.This is really useful for me.
kumarshiva
 
Posts: 7
Joined: Thu Oct 07, 2010 7:30 am
Has thanked: 0 time
Been thanked: 0 time


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post