Program for perform - until, COBOL Programming

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.

Data division.

Working-storage section.

01 n pic 9(2) value 0.

01  i  pic 9(2) value 1.

01 sum pic 9(4) value 0.

Procedure division.

Para-1.

  Display(1 1) erase.

  Display(5 5) "Enter a Number ".

  Accept n.

             Perform calc-para until i > n.

             Display(10 5) " Sum = " sum.

             Stop run.

Calc-para.

  Compute sum = sum + i.

             Add 1 to i.

Posted Date: 10/17/2012 7:45:37 AM | Location : United States







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

Write discussion on Program for perform - until
Your posts are moderated
Related Questions
FILE-CONTROL paragraph for the relative files: The normal format for the SELECT clause for a relative file is as shown below. SELECT  file-name  ASSIGN  TO  implementor-nam

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

PROGRAM TO DEMONSTRATE SORT VERB: The file for which a record having 2 fields, viz., Account Number and Name is already available. Sort the file based on the ascending order o

Concept of a two-dimensional table: Concept of a two-dimensional table can be easily extended to tables having three or more dimensions. The Handling of tables up to three dim

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

CLASS CONDITION:   The class condition establishes whether or not the value of the operand is numeric or alphabetic. The operand is numeric if it contains only the digits 0 t

NESTED IF STATEMENT:   The then and else statement of an IF statement can hold other IF statements. The involved IF statements in their turn may also hold other IF statements

77 level used for- It is Elementary level item. it Cannot be subdivisions of other items or cannot be qualified, or they can be subdivided themselves.

PROCEDURE DIVISION statements for the indexed files: All the statements which are available for a relative file are also available for an indexed file. READ STTATEMENT :

OCCURS CLAUSE - PROGRAM: We have to write a program to elaborate occurs clause. Get names and marks of the students and show them on the screen.   identification division.