Program for perform - varying, COBOL Programming

PROGRAM FOR PERFORM - VARYING:

We have to write a program to elaborate PERFORM ...VARYING

Identification division.

Program- id. PerfVary.

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 varying i from 1 by 1 until  i > n.

             Display(10 5) " Sum = " sum.

             Stop run.

Calc-para.

  Compute sum = sum + i.

Posted Date: 10/17/2012 7:46:21 AM | Location : United States







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

Write discussion on Program for perform - varying
Your posts are moderated
Related Questions
WRITE Statement:      The WRITE statement for a relative file has the format which is as shown below.          WRITE  record-name   [ FORM   identifier ]

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

PROGRAM FOR DIVIDE VERB:   We have to write an easy program to elaborate DIVIDE verb. You can also use edit characters in the program. Identification division. Program-

SUBTRACT VERB: The SUBTRACT verb is used to subtract one, or the sum of two or more numbers from one or more numbers and to store the result. The form of the SUBTRACT verb

Illustration of perform statement: PERFORM    CALCUALTE-TAX. In this illustration, the CALCULATE-TAX is either a section name or paragraph name. Assume that it is a section

Example of Open statement: Illustration: The OPEN INPUT TRANSACTION, OLD-MASTER OUTPUT NEW-MASTER. The illustration represents that there are two input files named the

CLOSE STATEMENT: When the processing of a file is completed, then the file may be closed. This is completed with the help of the CLOSE-verb. The form of the CLOSE statement is

Sign - Picture clause: The numeric data item can be signed or unsigned. If a numeric data is regarded as unsigned then during the execution these unsigned data items are treat

Occurs Clause: Let us establish tables with the help of an illustration. Assume that there are ten different types of income-tax rates that are read from some input medium and

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