Example of perform statement, COBOL Programming

Assignment Help:

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.


Related Discussions:- Example of perform statement

Record description for the variable-length records, Record Description for ...

Record Description for the Variable-length Records: When the variable- length records consists of records of various lengths, each record type is to be explained at level 01 f

Read statements - relative files, READ STATEMENTS: The common format f...

READ STATEMENTS: The common format for the read statements is as shown bellow. Format 1: READ file-name RECORD [ INTO   identifier ] [  ;  AT   END     imperative-s

Example of open statement, Example of Open statement: Illustration: ...

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

Program of occurs clause, OCCURS CLAUSE - PROGRAM: We have to write a ...

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.

Rules for apply for the condition name, Rules for apply for the condition n...

Rules for apply for the condition name: The rules below apply for the condition name. (i) The Condition names should be explained at level 88. The level number starts in ma

Program for add verb, PROGRAM FOR ADD VERB: We have to write a simple ...

PROGRAM FOR ADD VERB: We have to write a simple program to elaborate the ADD verb. You can also use edit characters in the program. Identification division. Program- id.

Edit characters for numeric data, Edit Characters for Numeric Data: Th...

Edit Characters for Numeric Data: The characters below can be used in the PICTURE clause to indicate the editing.   Z    *  $  -    +    CR    DB    .    ,    B    O    /

Block size - file characteristics , Block Size: The normal practice is...

Block Size: The normal practice is to group a number of consecutive records to form that is termed as a block or a physical record. The number of records in a block is frequen

File-control paragraph for the indexed files, FILE-CONTROL paragraph for th...

FILE-CONTROL paragraph for the indexed files: The common format for the SELECT clause for a file is as shown below: SELECT  file-name  ASSIGN   TO  implementor -name

Level numbers - cobol programming, LEVEL NUMBERS: The COBOL makes use ...

LEVEL NUMBERS: The COBOL makes use of the level number concept to explain the hierarchical data structure. A level number is a 2 digit number. The permitted level numbers a

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd