Example of constructing an arithmetic expression, COBOL Programming

Example of constructing an arithmetic expression:

An arithmetic expression may be proceeded by a + or - sign. These operations are known as unary + or unary - operators.

Illustrations of the valid arithmetic expressions are:

1230_Rules for constructing an Arithmetic Expression2.png

Note that whenever the right-hand side of a COMPUTE verb is a single identifier or literal, then the effect is that of a MOVE statement.

Illustration:

                       COMPUTE    A = B + C

 

has similar effect as that of the ADD B  C  GIVING  A

Illustration:

                       COMPUTE     F =   1.8 * C + 32

The value of the expression on the right-hand side is computed and this value is then moved to the F.  Assume that the C & F are defined with pictures 99 & ZZ9.9 respectively and the present value of C is 3.  Subsequently after the execution of the statement, the F will have the value 37.4.

Posted Date: 10/16/2012 5:32:17 AM | Location : United States







Related Discussions:- Example of constructing an arithmetic expression, Assignment Help, Ask Question on Example of constructing an arithmetic expression, Get Answer, Expert's Help, Example of constructing an arithmetic expression Discussions

Write discussion on Example of constructing an arithmetic expression
Your posts are moderated
Related Questions
RULES FOR OCCURS CLAUSE: The rules apply for the OCCURS clause and the subscripts are as shown below. (1) The integer in the OCCURS clause should be a positive integer.

Illustration of perform statement: PERFORM    CALCUALTE-TAX. In this illustration, the CALCULATE-TAX is either a section name or paragraph name. Assume that it is a section

TO WRITE A QUADRATIC EQN ROOTS ARE COMPLEX IN COBOL 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

WRITE statement: The WRITE statement for tape and sequential-disk files has the syntax shown below. WRITE            record-name      [  FROM    identifier   ] As a resu

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

DATA RECORD CLAUSE: The DATA RECORD clause, documents the record names defined for the file. For illustration, DATA RECORDS ARE REC-1, REC-2, REC-3 that means there are 3diffe

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

MOVE CORRESPONDING: It is frequently required to move some of the data items of one group to some other data items in the other group. If the names of the equivalent data item

PROGRAM FOR RENAMES CLAUSE: identification division. program- id. environment division. data division. working-storage section. 01 emp.      02 empdet.