Compute verb, COBOL Programming

COMPUTE VERB:

The COMPUTE verb is very powerful. All the evaluations performed by the other 4 verbs can also be completed easily by using the COMPUTE verb. Its normal format is:

          COMPUTE        identifier-1    ROUNDED   ,   identifier-2  ROUNDED     ... 

         =   arithmetic-expression       ;   ON SIZE ERROR imperative-statement

The COMPUTE Verb statement has the following meaning. During the execution of the arithmetic expression on the right side of the equal sign is computed and the value is then moved to the identifiers(s) on the left-hand side.  If any identifier on the left side of the equal sign is a numeric-edited item, then the editing takes place when the value of the expression is moved to the said identifier. The identifiers on the left side of the equal sign (=) should be numeric or numeric-edited elementary items. The right-hand side should be an arithmetic expression. They can also be an identifier (only numeric elementary items), a numeric literal or can specify a computation including two or more such identifiers and/or literals. The arithmetic expression has always a numeric value.  

 

Posted Date: 10/16/2012 5:27:51 AM | Location : United States







Related Discussions:- Compute verb, Assignment Help, Ask Question on Compute verb, Get Answer, Expert's Help, Compute verb Discussions

Write discussion on Compute verb
Your posts are moderated
Related Questions
Currency Sign - edit characters for numeric data: $ (Currency Sign): The single currency sign can appear at the leftmost place of a picture. In that situation the $ cha

Evaluate is like a case statement & Evaluate  stamenet can be used to replace nested Ifs. The difference b/w EVALUATE and case is that there is no 'break' is required for EVALUATE

PROGRAM FOR CONDITION NAMES: We have to write a simple program to demonstrate Condition names usage.  identification division.   program- id.   environment division.

Block Size: The normal practice is to group a number of consecutive records to form that is termed as a block or a physical record. The number of records in a block is frequen

Comparison of Nonnumeric Operands: A nonnumeric operand can be compared to the other nonnumeric operand according to the rules as shown below: (i) Fields of Equal Sizes:

FILE-CONTROL paragraph for the indexed files: The common format for the SELECT clause for a file is as shown below: SELECT  file-name  ASSIGN   TO  implementor -name

FD Entry for variable-length Records: The RECORDS CONTAINS and BLOCK CONTAINS clause are quite dissimilar in the case of files with variable- length records. The syntax of the

Comparison of the Numeric Operand with Nonnumeric Operand: The numeric operand can be compared to the nonnumeric operand subject to the restrictions which are as follows.

RELATIONAL CONDITION:   We know that a relational condition specifies a comparison between two operands and has the form.     Operand-1    relational-operator   operand-2

ADD VERB: The ADD Verb can be used to find the sum of two or more numbers and to store the sum.  The ADD verb takes any one of the two forms as shown below: