Example of perform statement, COBOL Programming

Example of Perform statement:

PERFORM BEGIN-CALCULATION THRU END-CALCULATION.

Assume, BEGIN-CALCULATION and END-CALCULTION is paragraph names. The execution of the PERFORM statement above will cause the execution of the group of the statements beginning with the initial statement of BEGIN-CALCULATION and ending with the last statement of end-calculation. It may be noted that there might be other paragraphs in between these two paragraphs. All these paragraphs region also included in the range. Ahead the execution of the range, then the control returns to the statement following the PERFORM statement.

It may be illustrious that the return of control after the execution of the statements in the particular range takes place implicitly. This means that at the ending of the range, the programmer must not put any statement (like GO TO) to transfer the control explicitly to the statement following the PERFORM statement. The compiler launches a return mechanism at the end of the range and it is this mechanism that is responsible for the return of the control.

The points shown below may be noted in connection with the range of a PERFORM statement.

(i) A GO TO statement is permitted within the range of a PERFORM statement. Though, it is the responsibility of the programmer to make sure that the control finally reaches the last statement of the range.

(ii) There is no limitation as to what can be the last statement of a range except that it cannot be a GO TO statement. Whenever an IF sentence is used at the end of a range, the next sentence for that IF sentence refers to the return mechanism.

(iii) The use of a PERFORM statement within the range of the other PERFORM Statement is permitted, a few compilers allow unrestricted use of these nesting of PERFORM statements. Some Compilers need that the range of the involved PERFORM statement should be either completely within or completely outside the range of the invoking PERFORM statement. In another words, the series of ranges specified in the Nested PERFORM statements must neither overlap nor share the similar Terminal statement. It is better to examine these limitations for the sake of the Portability.

(iv) The range of statements which should be performed gets linked up with the PERFORM STATEMNT ONLY WHE NTHE LATTER IS EXECUTED. When the control reaches the initial statement of the range through normal series or through explicit transfer of the control, then in the general way the range also gets executed. After the execution of the final statement of the range, the control falls through the later statement following the range.

Posted Date: 10/17/2012 2:10:47 AM | Location : United States







Related Discussions:- Example of perform statement, Assignment Help, Ask Question on Example of perform statement, Get Answer, Expert's Help, Example of perform statement Discussions

Write discussion on Example of perform statement
Your posts are moderated
Related Questions
PROGRAM FOR SIMPLE PERFORM: We have to write a program to elaborate simple PERFORM statement Identification division. Program- id.  Perf1. Environment division. Da

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

PROCEDURE DIVISION statements for the relative files: The statements OPEN, CLOSE, READ, WRITE and REWRITE that are available for sequential files are also available for the re

Non numeric: The nonnumeric literal is used in normal to output messages or headings. The Characters which are enclosed between " " constitute nonnumeric literal. The maximum

Write a COBOL IF sentence to use the values of numeric variables EXAM and COURSEWORK , both assumed to be with format PIC 999 and in the range 0 to 100 and to move the value:

The LENDER Bank offers mortgages on homes valued up to $500,000. The required down payment is calculated as follows: 4% of the first $60,000 borrowed 8% of the next $30,000 borro

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

Illustration of Multiply verb: (a)  MULTIPLY A BY B. In this situation the value of A & B will be multiplied and the product will be stored in B.  The decimal point locatio

File- Section &Working-Storage Section: a) FILE SECTION: The FILE SECTION includes the explanation of all data items that must be read from or written onto some external

CONDITION - COBOL Programming: The condition is an entity which at one point of time can have only one of the two values - true or false. As we already know that, the IF verb