Program for subtract verb, COBOL Programming

Assignment Help:

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.


Related Discussions:- Program for subtract verb

Rules for search verb, RULES FOR SEARCH VERB: The rules apply for the ...

RULES FOR SEARCH VERB: The rules apply for the SEARCH verb is as shown below: (1) The SEARCH verb can be applied only to a table that has the OCCURS clause and INDEXED phra

Common form of the read statements, Common form of the READ statements: ...

Common form of the READ statements: Format 1 is the common form of the READ statements. Format 2 is used when the access mode is either random or dynamic. For illustration,

Examples - edit characters for numeric data, Examples - Edit characters for...

Examples - Edit characters for numeric data: The following illustration illustrates the use of Z editing characters. The character b is used to indicate the space character an

Programs for redefines clause , PROGRAMS FOR REDEFINES CLAUSE: We have...

PROGRAMS FOR REDEFINES CLAUSE: We have to write a simple program to explain the REDEFINES clause at 01 level. identification division. program- id. Redef. environment

Rules of move verb, RULES OF MOVE VERB:  The Data movement is managed ...

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

Input-output section - cobol programming, INPUT-OUTPUT SECTION: This s...

INPUT-OUTPUT SECTION: This section holds information regarding the files to be used in the program. There are 2 paragraphs in this section- FILE-CONTROL & I-O-CONTROL. The

Floating insertion - , Floating Insertion   The currency symbol ($) c...

Floating Insertion   The currency symbol ($) can emerge in multiples on the left-hand side of the picture. In this situation the character will be treated in similar way as t

File characteristics, FILE CHARACTERISTICS: The task of file handling ...

FILE CHARACTERISTICS: The task of file handling is the responsibility of the system software termed as IOCS (Input-Output control system). Record Size: We know that th

Rules of renames clause, RULES OF RENAMES CLAUSE:   The rules below s...

RULES OF RENAMES CLAUSE:   The rules below should be observed while using the RENAMES clause: (i) All RENAMES entries should be written only after the last record descript

File volatility and file interrogation, File volatility: File volatili...

File volatility: File volatility associates to the number of times the updating of records are needed during some time period. File interrogation: Some files hold re

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd