Program for divide verb, COBOL Programming


 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.


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
Evaluate is like a case statement & Evaluate  stamenet can be used to replace nested Ifs. The difference b/w EVALUATE and case is that there is no 'break' is required for EVALUATE

UPDATING OF THE RELATIVE AND INDEXED FILES: The Sequential files are updated by creating a new master file from an existing old master file and a transaction file. Such an Upda

OCCURS - INDEXED BY PROGRAM: identification division. program- id. searching. environment division. data division. working-storage section. 01 table1.      0

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

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

FILLER CLAUSE: Consider the statements as shown below: 1)  01    f    pic     x(80)  value    all "-". This statement origins a line of 80 characters filled with "-"

Format for COBOL Programs: The COBOL is a high-level language. Therefore, a COBOL program can be executed on a computer for which a COBOL compiler exists. The compiler transla

WRITE STATEMENT: The records are written to be logical place as determined from the value of the record key. The INVALID KEY condition occurs in the cases shown below: (i)

RULES OF MOVE VERB:  The Data movement is managed by the rules which are as shown below: (a) The contents of the identifier - 1 or the value of the literal - 1 is moved to

CONDITION - COBOL Programming: The condition is an entity which at one point of time can have only one of the two values - true or false. As we already know that, the IF verb