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
CR and DB (Credit and Debit Sign): The two characters that is CR or DB symbol may appear only at the rightmost place of the picture. They are similar to the minus sign edit ch

Illustration of indexed tables: Index items defined through the INDEXED phrase of the OCCURS clause are one type of indexes. There can be other type of index items that are de

PROCEDURE DIVISION statements for the relative files: The statements OPEN, CLOSE, READ, WRITE and REWRITE that are available for sequential files are also available for the re

Example of Sign condition: The illustration below describes the use of the sign condition. Illustration:     77  BALANCE  PIC  S9 (6) V99.       .       .     I

Comparison of the Numeric Operand with Nonnumeric Operand: The numeric operand can be compared to the nonnumeric operand subject to the restrictions which are as follows.

PROGRAM FOR SIZE ERROR:   We have to write an easy program to elaborate the size error option. Identification division. Program- id. sizeerr. Environment division.

REWRITE statement: The REWRITE statement is used to update the existing record in a disk file. The normal format is as shown below: REWRIE  record-name  [  FROM      ide

DELETE STATEMENT: The format of the delete statement is as shown below: DELETE   file-name RECORD   [  ;   INVALID   KEY  imperative-statement  ] Whenever the ACCESS MOD

PERFORM WITH UNTIL OPTION: The format is as shown below: Illustration:  A) Perform p-3 until i > 5. Here p-3 will be executed whenever i B)  Perform p-2 thru

PROGRAM FOR SIMPLE PERFORM: We have to write a program to elaborate simple PERFORM statement Identification division. Program- id.  Perf1. Environment division. Da