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
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

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

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 :

Example of If- else statement Illustration:   IF   QUANTITY IS NUMERIC AND QUANTITY IS POSITIVE          MOVE ZERO TO ERROR-CODE. COMPUTE SALES VALUE=QUANTITY*RATE

COMPOUND CONDITION: The two simple conditions can be connected by the logical operators AND or OR to form a compound condition (also termed as combined condition). When two co

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,

RELATIONAL CONDITION:   We know that a relational condition specifies a comparison between two operands and has the form.     Operand-1    relational-operator   operand-2

Configuration Section: This section holds an overall specification of the computer used for the purpose of the compilation and execution of the program. There are in all 3 par

FD Entry for variable-length Records: The RECORDS CONTAINS and BLOCK CONTAINS clause are quite dissimilar in the case of files with variable- length records. The syntax of the

Example of File-control: The assign clause assigns a specific physical peripheral device name to a file. The physical peripheral device are machine-dependent. We use the devic