skip to main content

Procedure Division Statements : COMPUTE

COMPUTE
General Format
COMPUTE { Result-1 [ROUNDED]  } ... = Arithmetic-Expression 
  [ ON SIZE ERROR Imperative-Statement-1 ] 
  [ NOT ON SIZE ERROR Imperative-Statement-2 ] 
  [END-COMPUTE]
Syntax rules
1.
General rules
1.
2.
Examples
Compute arithmetic expression, leave the result in num-1
compute num-1 = num-2 * interest-rate / 100 / 12
Compute arithmetic expression, leave rounded result in num-1 and validate if result fits in num-1 defined size.
compute num-1 rounded = num-2 * interest-rate / 100 / year-days
  on size error display message "The last computation did not fit in num-1!"
  not on size error display message "new value of num-1 : " num-1

Copyright (c) 2017 Veryant
Contact us
Please share your comments on this manual or on any
Veryant product documentation with the email button at the top left