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
PROGRAM FOR MASTER FILE MAINTENANCE: We have to write a program to keep the stu-file for which a record has just 2 fields,viz., rno(Roll Number) and name(Student Name). Give t


Example of condition names: The illustration below is of the use of the condition names  77  MARITAL-STATUS     PIC    9   88  SINGLE    VALUE    IS     ZERO   88  MA

RESERVE clause: This clause indicates the number of buffers to be used for the file. Integer-1 specifies this number. ORGANIZATION/ACCESS clause: These two clause

, (Comma) : A comma, whenever used in a picture, is considered as an insertion character and inserted wherever it become visible. There can be more than one comma in the pictu

SIGN CONDITION:   The sign condition establishes whether or not the algebraic value of an operand is negative, positive or zero. The operand can be either the numeric identif

Example of Accept statement: For illustration, ACCEPT FLAG-A can be specified to read the value of the FLAG_A from the console. It may be keep in mind that no file definition


Picture Clause: The picture clause explains the general characteristics of an elementary data item. These characteristics are elaborated below: Class: In COBOL the

STATEMENTS FOR SEQUENTIAL FILES: A basic operation on a file includes the reading and writing of its records. Whenever the file is sequential, there are three verbs for the