Rounded option, COBOL Programming

Assignment Help:

ROUNDED OPTION:

Let us consider the DATA DIVISION entries which are as shown below:

1994_ROUNDED OPTION.png

Now, subsequent to the execution of the statement ADD A B GIVING C, the C will hold 58.6 rather than of 58.685 as  C can keep only one digit after the decimal point. Rather than that of this usual truncation, the rounding can be specified through the ROUNDED option. 

The ROUNDED option can be described as shown:

 

ADD        A             B            GIVING              C                ROUNDED

Now, the content of the C will be 58.7 rather than of 58.6.

It may be noted from the above illustration that whenever an arithmetic operation is executed, and if the number of places in the fractional part of the outcome happens to be bigger than the number of placed given for the fractional part in the receiving field, then truncation will occur.  Though, if the ROUNDED option is identified, 1 is added to the last digit whenever the most significant digit being thrown out is bigger than or equal to 5.  In the illustration shown here the most significant digit of the excess are 8 that is greater than 5. And hence, 1 has been added to the 6 that is the last digit of the receiving field. On another hand, if A and

B contains the 23.412 and 35.213 respectively, then both the statements

ADD        A             B            GIVING              C

and

ADD        A             B            GIVING              C                ROUNDED

will give the equivalent result and in both the cases C will have the value 58.6.

The ROUNDED option can be specified in the situation of any arithmetic verb by writing the word ROUNDED after the identifier, denoting the field which receives the result of the operation.  The ROUNDED phrases cannot be specified for the identifier which receives the remainder in the DIVIDE operation.


Related Discussions:- Rounded option

Blank insertion and zero insertion, B (Blank Insertion) : The occurren...

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:

Open statement - sequential files, OPEN statement: We know that the pr...

OPEN statement: We know that the processing of a file should start with the execution of an OPEN statement. The file can be opened in any one of the 4 open modes - INPUT, OUTP

Object-computer - configuration section, Object-Computer - Configuration se...

Object-Computer - Configuration section: The computer name specifies a specific computer on which the object program is to be executed. The MEMORY SIZE is used to show the

Column and field in cobol program, Column and Field in COBOL program: ...

Column and Field in COBOL program: In COBOL there are 2 types of entries termed as margin A and margin B entries. The Margin A entries start from the column 8, 9, 10 or 11 and

Program for renames clause, PROGRAM FOR RENAMES CLAUSE: identification...

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

Example of write statement, Example of Write statement: Illustration:...

Example of Write statement: Illustration: (i) WRITE TRANS-RECORD AFTER ADVANCING 3 LINES. This WRITE statement specified that the TRANS-RECORD is a record name of a fi

Example of read statement, Example of read statement: Illustration: ...

Example of read statement: Illustration: READ OLD-MASTER AT END MOVE ZERO TO END-OF-RECORDS. As a result of this statement, generally the next record from the OLD-MAST

Example of compound condition, Example of compound condition: In commo...

Example of compound condition: In common, a compound condition has the form which is as shown below: Where condition-1 & condition-2 can be any one of the below:

Declarative and file status clause, DECLARATIVE and FILE STATUS Clause: ...

DECLARATIVE and FILE STATUS Clause: The input-output exception condition in the situation of a direct access files can be handled by a declarative procedure in a manner simila

Data division, Data Division: The Data Division is a part of the COBOL...

Data Division: The Data Division is a part of the COBOL program where every data item processed by the program is described. It is very important to note that unless a data

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd