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
ROUNDED OPTION: Let us consider the DATA DIVISION entries which are as shown below: Now, subsequent to the execution of the statement ADD A B GIVING C, the C will hold

Numeric -   Literals : The numeric literal can be created with the help of digits only. It can have a sign (+ or -) and can also have a decimal point. If no sign is specifi

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

Write a COBOL IF sentence to use the values of numeric variables EXAM and COURSEWORK , both assumed to be with format PIC 999 and in the range 0 to 100 and to move the value:

PROGRAM FOR INDEXED SEQUENTIAL FILE CREATION: We have to write a program to create an Indexed Sequential File in a dynamic mode for Student particulars. Suppose just 3 fields:

CONDITIONS-NAME CONDITION:   The condition name is an entity which itself is a condition and these can have either a true or false value. Though, a condition name cannot be d

PROGRAM FOR PERFORM ...UNTIL We have to write a program to find the sum of "n" natural numbers. Identification division. Program- id. PerfUntil. Environment division.

INDEXED SEQUENTIAL FILES: In the indexed sequential files which are also known as indexed files, the records are stored in the sequence order generally in ascending order. In

COBOL Words: The COBOL word can be formed by using the characters as shown below: 0-9 A-Z (a-z) - (hyphen) The rules below should be hold in forming the COBOL words.

Illustration of simple sort verb: Illustration: Suppose that we have a card file with the following records description in the data division. The names of the work fil