Occurs clause - program, COBOL Programming

Assignment Help:

OCCURS CLAUSE - PROGRAM:

We have to write a program to demonstrate the occurs clause. Get names of the students and show them on the screen.

 identification division.

  program- id.

  environment division.

  data division.

  working-storage section.

  01  n  pic  9(2) value 0.

  01  i  pic  9(2) value 0.

  01  name-in.

    02 name pic x(20) occurs 20 times.

  01  key- in pic x value space.    

  procedure division.

  p-1.

    display(1 1) erase.

    display(3 5) "Enter How many times".

    accept n.

    display(1 1) erase.

    perform get-para n times.

    display(1 1) erase.

    move 0 to i.

    perform disp-para n times.

  stop run.

get-para.

  accept name(i).

  add 1 to i.

disp-para.

  display name(i).

  accept key- in.

  add 1 to i.


Related Discussions:- Occurs clause - program

Example of move corresponding, Example of Move corresponding: Consider...

Example of Move corresponding: Consider the DATA DIVISION entries shown below. Suppose it is needed that the data stored in the 4 fields of the PAY_REC should be

Configuration section - cobol program, Configuration Section: This sec...

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

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

Go to, GO TO, STOP RUN: The GO TO verb is used to completely transfer ...

GO TO, STOP RUN: The GO TO verb is used to completely transfer the control to elsewhere in the program. Its form is as shown below: GO TO procedure-name As a result o

Common form of the read statements, Common form of the READ statements: ...

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,

Data division, Data Division: The Data Division is a part of the COBOL...

Data Division: The Data Division is a part of the COBOL program where every data item processed by the program is described. It is very important to note that unless a data

Comparison of the numeric operand with nonnumeric operand, Comparison of th...

Comparison of the Numeric Operand with Nonnumeric Operand: The numeric operand can be compared to the nonnumeric operand subject to the restrictions which are as follows.

Rules of renames clause, RULES OF RENAMES CLAUSE:   The rules below s...

RULES OF RENAMES CLAUSE:   The rules below should be observed while using the RENAMES clause: (i) All RENAMES entries should be written only after the last record descript

Program for perform - until, PROGRAM FOR PERFORM ...UNTIL We have to w...

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.

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