Professional Documents
Culture Documents
Agenda
Problem Statement Intermediate Results Intermediate Results Size Actual Calculation Steps
Problem Statement -
The Equation creating ProblemCOMPUTE RDTL-RTG-PARM-2-VAL = RDTL-RTG-PARM-1-VAL * (RDTL-RT/100) Variable Declaration 1. RDTL-RTG-PARM-2-VAL & RDTL-RTG-PARM-1-VAL defined as S9(13)V9(12) COMP-3 2. RDTL-RT defined as S9(04)V9(5) COMP-3 The Values assigned RDTL-RTG-PARM-1-VAL = 4352146 RDTL-RT = 1.5166 Results RDTL-RTG-PARM-2-VAL = 4352146 *( 1.5166 /100) = 66004.6462 ~ 66005 But the actual value stored in table is 65979.
Intermediate Result
IBM Mainframe COBOL Manual states The compiler treats arithmetic statements as a succession of operations, performed according to operator precedence, and sets up an intermediate field to contain the results of these operations.
COMPUTE Y = A + B * C - D / E + F ** G is calculated as: ** F BY G yielding ir1 MULTIPLY B BY C yielding ir2 DIVIDE E INTO D yielding ir3 ADD A TO ir2 yielding ir4 SUBTRACT ir3 FROM ir4 yielding ir5 ADD ir5 TO ir1 yielding Y
op1 The first operand in a generated arithmetic statement. For division, op1 is the divisor. op2 The second operand in a generated arithmetic statement. For division, op2 is the dividend. i1,i2 The number of integer places in op1 and op2, respectively. d1,d2 The number of decimal places defined for op1 and op2, respectively.
dmax In a particular statement, the larger of either: The number of decimal places needed for the final result field(s), or The maximum number of decimal places defined for any operand, except divisors or exponents.
Calculation
Decimal Places for IR1 will be 5. So IR1 = 1.5166/100 = .01516 RDTL-RTG-PARM-2-VAL = 4352146 *.01516 =65979