In addition to the compiler's default truncation behavior, the compiler also supports the ability to use a data item's storage capacity instead of its PICTURE phrase to determine the largest numeric value it could hold. This is the -Dz compile option. However, other COBOL systems have similar concepts that differ in some details from -Dz. To give you the greatest amount of flexibility and compatibility with other COBOLs, there are four truncation options for numeric values. Only one of these options may be used for any individual compile. The following chart describes and compares these options:
|Full ANSI COBOL rules are in place. Each numeric data item stores values up to its PICTURE in size. A small number of USAGE types provide exceptions (such as COMP-X). These are documented under the USAGE phrase. Values larger than allowed by the PICTURE are truncated using the standard size rules when the data item is the target of a MOVE statement. The results of an arithmetic overflow (without the SIZE phrase) are undefined.
|Similar to the default, but COMP-5 is added to the list of data types that ignore their PICTURE when determining the largest value they can hold. However, COMP-5 items do use their PICTURE when moving a value to a nonnumeric data item. The name of this option is similar to the name used by some other COBOL systems that behave this way.
|All binary data types ignore their PICTURE when determining the largest value they can hold. However, the PICTURE is used when moving data from a binary number to a nonnumeric data item. The name of this option is similar to the name used by some other COBOL systems that behave this way.
|All binary and packed-decimal data types ignore their PICTURE when determining the largest value they can hold. The PICTURE is not used when moving to a nonnumeric destination (the largest possible value determines the number of digits moved instead).