COMPUTE Statement COBOL

The COMPUTE statement calculates the value of an arithmetic expression and assigns the value to one or more data items.

COMPUTE Statement

identifier-1 must refer to either an elementary numeric item or an elementary numeric edited item.

An arithmetic expression consisting of a single identifier or literal provides a method of setting the value of identifier-1 equal to the value of the single identifier or literal.

The COMPUTE statement allows the user to combine arithmetic operations without the restrictions on composite of operands, receiving data items, or both, imposed by the arithmetic statements ADD, SUBTRACT, MULTIPLY and DIVIDE.

Additional rules and explanations regarding features of the COMPUTE statement that are common to other arithmetic statements can be found in the discussion of common rules. See in particular the discussions of the ROUNDED phrase, the size error condition, overlapping operands, modes of operation, composite size, and incompatible data.

COMPUTE Statement Examples


Face Book Twitter Google Plus Instagram Youtube Linkedin Myspace Pinterest Soundcloud Wikipedia

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

COBOL Topics