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
WRITE STATEMENT: The WRITE Statement verb releases a record in an output file. The syntax for the WRITE statement can be unlike depending on the output device and the medium us

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

IF STATEMENT: The easiest form of the IF statement is  IF condition-1 statement-1 where the condition-1 may be any one from the shown below. When the condition-1

REDEFINES CLAUSE: At times it may be found that two or more storage regions defined in the DATA DIVISION are not in use concurrently. In such situations only one storage regio

File- Section &Working-Storage Section: a) FILE SECTION: The FILE SECTION includes the explanation of all data items that must be read from or written onto some external

BLANK WHEN ZERO: BLANK WHEN ZERO is an editing clause that may be used along with a picture. This will set the whole data item to blanks of its value is equal to zero. Though,

B (Blank Insertion) : The occurrence of a B anyplace in the picture will insert a space character in the edited data. There can be more than one B in the picture. Examples:

PROGRAM FOR MOVE CORRESPONDING: We have to write a simple program to demonstrate Move Corresponding. identification division.   program- id.   environment division.

PERFORM WITH UNTIL OPTION: The format is as shown below: Illustration:  A) Perform p-3 until i > 5. Here p-3 will be executed whenever i B)  Perform p-2 thru

Occurs Clause: Let us establish tables with the help of an illustration. Assume that there are ten different types of income-tax rates that are read from some input medium and