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
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.

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

Literals: The actual values can too appear in a program. These values are termed as literals. For illustration, the statement MOVE 0 TO TOTAL indicates that the value zero wil

Example of constructing an arithmetic expression: An arithmetic expression may be proceeded by a + or - sign. These operations are known as unary + or unary - operators. Il

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

START STATEMENT: The START statement places the files to the initial logical record whose record key satisfies the condition specified by the KEY phrase. The access mode shoul

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

can we move spaces to numeric field

Comparison of Nonnumeric Operands: A nonnumeric operand can be compared to the other nonnumeric operand according to the rules as shown below: (i) Fields of Equal Sizes:

What is the difference b/w index and subscript? Subscript indicates to the array occurrence whereas index is the displacement (in no of bytes) from the beginning of the array.