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
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

Illustration of the abbreviation: A few illustration of the abbreviation are given below: Illustration: The compound condition  AMOUNT GREATER THAN 499 AND AMOUNT L

READ STATEMENT: The aim of this verb is to make available the next logical record from the input file. It is important to note the meaning of the "next" logical record in the

What is the difference between subscript and index

Illustration of Multiply verb: (a)  MULTIPLY A BY B. In this situation the value of A & B will be multiplied and the product will be stored in B.  The decimal point locatio

Example of Redefines clause: This illustration describes a sales record that may either contain the total amount of sale or the quantity (QTY) and UNIT-PRICE. The aim of such

PROGRAM FOR SCREEN SECTION WITH FILES: identification division.   program- id.   environment division.          input-output section.   file-control.     select

File- Section &Working-Storage Section: a) FILE SECTION: The FILE SECTION includes the explanation of all data items that must be read from or written onto some external

Illustration of Divide verb: (a) DIVIDE 5 INTO A. If the value of A is 20, then after execution of this statement the value of A will be 4. The older value of A will be los

Literals: The actual values can too appear in a program. These values are termed as literals. For illustration, the statement MOVE 0 TO TOTAL indicates that the value zero wil