Occurs clause - program, COBOL Programming

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.

Posted Date: 10/18/2012 1:58:25 AM | Location : United States







Related Discussions:- Occurs clause - program, Assignment Help, Ask Question on Occurs clause - program, Get Answer, Expert's Help, Occurs clause - program Discussions

Write discussion on Occurs clause - program
Your posts are moderated
Related Questions
UPDATING OF THE RELATIVE AND INDEXED FILES: The Sequential files are updated by creating a new master file from an existing old master file and a transaction file. Such an Upda

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

Column and Field in COBOL program: In COBOL there are 2 types of entries termed as margin A and margin B entries. The Margin A entries start from the column 8, 9, 10 or 11 and

Example of Level numbers - cobol programming: To explain the hierarchical structure introduced above, the concept of the level number is employed in COBOL. The most broad

Currency Sign - edit characters for numeric data: $ (Currency Sign): The single currency sign can appear at the leftmost place of a picture. In that situation the $ cha

PROGRAM FOR SCREEN SECTION:  identification division.   program- id.   environment division.   data division.   working-storage section.   01  a pic 9(2) value

READ STATEMENT: The aim of this verb is to make available the next logical record from the input file. It is important to note the meaning of the "next" logical record in the

SEQUENTIAL FILES:   The purpose of the proposed section is to introduce the concepts such as File characteristics, File Description for Fixed-Length Records, File-Control

CONDITIONS-NAME CONDITION:   The condition name is an entity which itself is a condition and these can have either a true or false value. Though, a condition name cannot be d

Illustration of Perform with varying option: A) Perform para-3 varying the k from 1 by 1 until k > 10. Here para-3 will be constantly executed 10 times (For k=1,2,3, .....1