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
Example of Special-names: Consider the illustration: Let the SPECIAL-NAMES paragraph be as shown: SPECIAL-NAMES. CHANNEL 1 IS PAGE-TOP. The Channel is related with the t

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

Rules for constructing an Arithmetic Expression: The rules for constructing an arithmetic expression are as shown below: (i) When an arithmetic expression specifies a calcu

Picture Clause: The picture clause explains the general characteristics of an elementary data item. These characteristics are elaborated below: Class: In COBOL the

PROGRAM FOR PERFORM ...UNTIL We have to write a program to find the sum of "n" natural numbers. Identification division. Program- id. PerfUntil. Environment division.

PROGRAM FOR CONDITION NAMES: We have to write a simple program to demonstrate Condition names usage.  identification division.   program- id.   environment division.

Example of add verb: (a) ADD A TO B. This illustration represents that the value of A will be added to the value of B and the result will be stored in B.  The alignment of

Display control verbs in Cobol

TO WRITE A QUADRATIC EQN ROOTS ARE COMPLEX IN COBOL PROGRAM

There are some restrictions when these procedures are used. (i) The Procedure should not contain any SORT/MERGE statement. (ii) An explicit transfer of the control outside