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

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

Example of Sign condition: The illustration below describes the use of the sign condition. Illustration:     77  BALANCE  PIC  S9 (6) V99.       .       .     I

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

VALUE CLAUSE: The value clause defines the preliminary value of the data item. Normally initialization will be completed just before the first statement in the procedure di

Program for Sequential File Creation & Rewriting  We have to write a program to create a Length file with just two fields: l (Length) and l-c (Length-Code). Add a few records.

ADD VERB: The ADD Verb can be used to find the sum of two or more numbers and to store the sum.  The ADD verb takes any one of the two forms as shown below:

FD Entry for variable-length Records: The RECORDS CONTAINS and BLOCK CONTAINS clause are quite dissimilar in the case of files with variable- length records. The syntax of the

PROGRAM FOR IF -ELSE: We have to write a program to check whether the given number is ODD or EVEN. You can use IF..ELSE. Identification division. Program- id. IfElse.

PROGRAM FOR SIMPLE PERFORM: We have to write a program to elaborate simple PERFORM statement Identification division. Program- id.  Perf1. Environment division. Da