Program for size error , COBOL Programming

PROGRAM FOR SIZE ERROR:

 We have to write an easy program to elaborate the size error option.

Identification division.

Program- id. sizeerr.

Environment division.

Data division.

Working-storage section.

77  a     pic    s9(3) value 0.

77  b      pic    s9(3) value 0.

7    c      pic    s9(3) value 0.

77  e-c   pic   +z(3).

Procedure division.

Para-1.

Display(1 1) erase.

Display(3 5) "Enter first number :".

Accept a.

Display(5 5) "Enter second number :".

  Accept b.

            Sum a b to c on size error 

                      display (10 5) "Size error on c ---Please increase size"

                       go to end-para.

       Move c to e-c.

          Display(15 5) "Sum = " e-c.

End-para.

  Stop run.

Description:   This program gets 2 inputs from the user.

                      It adds them by using the ADD verb. 

                      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:31:01 AM | Location : United States







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

Write discussion on Program for size error
Your posts are moderated
Related Questions
BLOCK CONTAINS CLAUSE: Integer -1 of the BLOCK CONTAINS clause indicates the block size either in terms of records or in terms of characters. For illustration, BLOCK CONTAINS

LABEL RECORD CLAUSE: This clause specifies whether or not the standard header and trailer labels must be present in the magnetic-tape files. VALUE OF CLAUSE: The VAL

Structure of a COBOL Program: Every COBOL program should have the 4 divisions in the order in which they are specified below: 1. Identification division 2. Environment D

ADD and SUBTRACT CORRESPONDING: The CORRESPONDING option can also used with the ADD and SUBTRACT verbs. The following are some of the formats of these verbs with the CORRESPON

I uploaded a file from PC to Mainframe, variable LRCL 256. In my COBOL program I defined it as FD INPUT-FILE LABEL RECORDS ARE OMITTED BLOCK CONTAINS 0 RECORDING MODE

Plus Sign - edit characters for numeric data: + (Plus Sign) : A plus sign is alike to minus sign except that when the item is positive, +sign will be inserted rather th

PROGRAM FOR ELECTRICITY BILL: An electricity company supplies electricity to 4 types of customers coded 1, 2, 3 & 4.The rate schedule for customers is shown in one table as

CONDITIONS-NAME CONDITION:   The condition name is an entity which itself is a condition and these can have either a true or false value. Though, a condition name cannot be d

CLOSE statement: The simplified syntax of the CLOSE statement is as shown below:   CLOSE          file-name-1   [WITH   LOCK   ]                         [  , file-

Illustration of Search verb: To illustrate the other use of SEARCH verb, assume we wish to search the similar tab to find the number of persons whose deposited amount is more