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
Rules for Simple sort verb: The work file is to be defined by a sort elaboration entry (SD entry).The format of SD entry is as shown below. The rules below should be taken

Format for COBOL Programs: The COBOL is a high-level language. Therefore, a COBOL program can be executed on a computer for which a COBOL compiler exists. The compiler transla

What is the difference between subscript and index

DELETE STATEMENT: The format of the delete statement is as shown below: DELETE   file-name RECORD   [  ;   INVALID   KEY  imperative-statement  ] Whenever the ACCESS MOD

Valid and Invalid Word - Cobol words: Valid Word             Invalid Word & Reason emp-sal                  -pay   ( it starts with a hyphen)  TOTAL MARK (blank space em

GO TO, STOP RUN: The GO TO verb is used to completely transfer the control to elsewhere in the program. Its form is as shown below: GO TO procedure-name As a result o

Figurative Constants: The Figurative constants have several fixed names and the compiler recognizes these names and it sets up the equivalent values in the object program.

Example of If- else statement Illustration:   IF   QUANTITY IS NUMERIC AND QUANTITY IS POSITIVE          MOVE ZERO TO ERROR-CODE. COMPUTE SALES VALUE=QUANTITY*RATE

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

Second form of Divide verb: The second form of this verb is as shown below: In this situation the identifier-1 or numeric- literal-1 will be divided by identifier-2 or