Program for divide verb, COBOL Programming

PROGRAM FOR DIVIDE VERB:

 We have to write an easy program to elaborate DIVIDE verb. You can also use edit characters in the program.

Identification division.

Program- id. Divverb.

Environment division.

Data division.

Working-storage section.

77  a  pic    s9(3)v9(2) value 0.

77   b  pic     s9(3)v9(2) value 0.

77   c pic      s9(4)v9(2) value 0.

77   e-c pic   -z(4).z(2).

Procedure division.

Para-1.

Display(1 1) erase.

   Display(3 5) "Enter first number :".

  Accept a.

  Display(5 5) "Enter second number :".

  Accept b.

            Divide a by b giving c.

       Move c to e-c.

          Display(15 5) "Answer = " e-c.

  Stop run.

Description:   This program gets 2 inputs from the user.

                      It divides them by using the DIVIDE verb. 

                      a/b is computed and stored in c.

                      The unedited result is accessible in c.

                      We move c to e-c, where the edit characters are accessible.

                      Keep in mind that the variable e-c makes use of the - edit character.

                      The e-c will always be exhibited with result.

Posted Date: 10/17/2012 1:30:13 AM | Location : United States







Related Discussions:- Program for divide verb, Assignment Help, Ask Question on Program for divide verb, Get Answer, Expert's Help, Program for divide verb Discussions

Write discussion on Program for divide verb
Your posts are moderated
Related Questions
Selection of file Organization: While designing a file, the programmer should select an appropriate association for a file. The order in which the choice is to be made is as s

can we move spaces to numeric field

Environment Division: The Environment Division is the second division in the COBOL source program. It is mainly machine-dependent . The computer and all the peripheral dev

Size: The number of characters or digits needed to store the data item in the memory in termed as the Size of the data item. All the 4 general characteristics explained can

REWRITE STATEMENT: As in the situation of a relative file, the REWRITE statement needs that the file should be opened in the I-O mode, and if the SEQENTIAL access mode is spec

Label Records / Disk Directory: The most important information stored in the header label is what is termed as the file title. In the situation of magnetic-disk files the labe

IF ... ELSE STATEMENT: We are familiar with an easy form of the IF statement. The common form of the IF statement is as shown below: Each of the statement-1 and statem

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

Example of Move corresponding: Consider the DATA DIVISION entries shown below. Suppose it is needed that the data stored in the 4 fields of the PAY_REC should be

Identification Division: The Identification Division is the first division of each and every COBOL source program. The paragraph PROGRAM-ID is necessary in most of the mac