Intermediate Results

As the expression is evaluated, one or more intermediate results is derived. Conceptually, each intermediate result is stored in a temporary data item, the value of which is determined by the parameter you select in the ARITHMETIC Compiler directive.

If you select the ARITHMETIC"MF" Compiler directive, the Micro Focus COBOL system evaluates each intermediate result using an internal floating-point register of 40 decimal digits. The most significant nonzero digit of each nonzero intermediate result is stored in the first digit of the register. The decimal point location depends on the value. Intermediate results are truncated to 40 digits.

If you select the ARITHMETIC"TRUNC20" Compiler directive, the Micro Focus COBOL system evaluates each intermediate result in the same manner as when ARITHMETIC"MF" is selected, except that the number of digits to the right of the decimal point is truncated to 20 at each step in the evaluation of the expression. You should use this directive only when you require truncation similar to that provided in COBOL WorkBench. If you use this directive, you must not change the setting of the INTLEVEL compiler directive from its default value of "2". This means that you cannot use some of the newer features, such as numeric pictures with more than 18 total digits, with the TRUNC20 parameter.

The OS/VS COBOL, VS COBOL II, DOS/VS COBOL, COBOL/370 and OS/390 systems compute intermediate results to an accuracy determined by the pictures of the operands in the expressions. The rules, which are slightly different for each version of COBOL, are documented in appendices of the IBM VS COBOL for OS/VS manual, the VS COBOL II Application Programming Guide, and the COBOL for OS/390 & VM V2R2 Programming Guide. Each intermediate result has a picture of 9(n)V9(m). The maximum value of n+m is either 30 or 31 depending on the system and the chosen arithmetic option.

If you specify the OSVS or VSC2 options for intermediate results, this COBOL system emulates the selected mainframe behavior by truncating its results accordingly, with the following limitations: