Program of occurs clause, COBOL Programming

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.

  program- id.

  environment division.

  data division.

  working-storage section.

  01  n  pic  9(2) value 0.

  01  i  pic  9(2) value 1.

  01  stu-det.

     02 stu-rec occurs 10 times.

    03 name pic x(20).

    03 mark pic 9(3).

  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 1 to i.

    perform disp-para n times.

    stop run.

  get-para.

    accept name(i).

    accept mark(i).

    add 1 to i.

  disp-para.

    display name (i).

    display mark (i).

    accept key- in.

    add 1 to i.

Posted Date: 10/18/2012 1:59:16 AM | Location : United States







Related Discussions:- Program of occurs clause, Assignment Help, Ask Question on Program of occurs clause, Get Answer, Expert's Help, Program of occurs clause Discussions

Write discussion on Program of occurs clause
Your posts are moderated
Related Questions
Floating Insertion   The currency symbol ($) can emerge in multiples on the left-hand side of the picture. In this situation the character will be treated in similar way as t

PERFORM STATEMENT:   The PERFORM statement can be used to execute the group of consecutive statements written elsewhere in the program. We refer to this group of statements a

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

FILE-CONTROL ENTRIES FOR THE SEQUENTIAL FILES: The characteristics of each and every files handled in a program are specified in the ENVIRONMENT DIVISION and DATA DIVISION.

SEARCH VERB: The SEARCH verb is used to position elements in one-dimensional tables. Let us consider the following problem. Assume that each element of a table consists of thr

single program how may when statement has used

PROGRAM FOR PERFORM - VARYING: We have to write a program to elaborate PERFORM ...VARYING Identification division. Program- id. PerfVary. Environment division. Dat

INPUT AND OUTPUT PROCEDURE IN SORT STATEMENT: The common format of the SORT statement can write as shown below: The format of the RELEASE statement is as shown be

STATEMENTS FOR SEQUENTIAL FILES: A basic operation on a file includes the reading and writing of its records. Whenever the file is sequential, there are three verbs for the

WRITE Statement:      The WRITE statement for a relative file has the format which is as shown below.          WRITE  record-name   [ FORM   identifier ]