Program for subtract verb, COBOL Programming

PROGRAM FOR SUBTRACT VERB:

We have to write a simple program to elaborate the SUBTRACT verb. You can also use edit characters in the program.

Identification division.

Program- id. Subverb.

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  e-b pic  +z(3).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.

  Subtract a  from b.

  Move b to e-b.

  Display(15 5) "b-a = " e-b.

  Stop run.

Description:   This program gets 2 inputs from the user.

                      It subtracts them by using the SUBTRACT verb. 

                      b-a is computed and stored in b.

                      Afterward the execution: OLD value of a is similar

                                                             OLD value of b is lost and

                                                             b-a is stored in b.

                     The unedited result is available in the b.

                     We move b to e-b, where the edit characters are available.

                     Note that the variable e-b makes proper use of the + edit character.

                       The e-b will always be exhibited with result.

Posted Date: 10/17/2012 1:28:29 AM | Location : United States







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

Write discussion on Program for subtract verb
Your posts are moderated
Related Questions
START STATEMENT: The START statement places the files to the initial logical record whose record key satisfies the condition specified by the KEY phrase. The access mode shoul

Transaction file : A transaction file is a file which contains new records those changes to old records which are used to update the master file. The problem of file updatio

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


Illustration of Subtract verb: (a) SUBTRACT A FROM B. This illustration means that the value of A will be subtracted from the value of B and the subtracted result will be s

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

Direct Organization: Besides the relative or indexed organization, also a direct access file can be designed to have what is termed as direct organization.  In this organizati

PROCEDURE DIVISION statements for the indexed files: All the statements which are available for a relative file are also available for an indexed file. READ STTATEMENT :

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)

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