Occurs - indexed by program, COBOL Programming


identification division.

program- id. searching.

environment division.

data division.

working-storage section.

01 table1.

     02 data1 occurs 10  times indexed by a1. 

  03  name pic x(25).

  03  sal  pic 9(6).

01   n   pic 9 value 0.  

  01   tot pic 9(2) value 0.

  01   i   pic 9 value 0.

procedure division.


  display(1 1) erase.

  display(5 5) "Enter Data .....".

  display(7 5) "Enter No.of Records : ".

  accept n.

          perform init-para varying i from 1 by 1 until i > n.

  perform get-para varying i from 1 by 1 

      until i > n.

  set a1 to 1.


        search data1 at end go to p-3

  when  sal (a1) > 1000  

     add 1 to tot.

        set a1 up by 1

        go to p-2.


  display(20 5) "Total Records > 1000 [sal] = " tot.

              stop run.     


  display(1 1) erase.

  display(3 5) "Name : ".

  accept name (i).

  display(5 5) "Salary : ".

  accept sal (i).


               move spaces to name(i).

  move 0 to sal(i).

Posted Date: 10/18/2012 2:00:04 AM | Location : United States

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

Write discussion on Occurs - indexed by program
Your posts are moderated
Related Questions
Example of Sign condition: The illustration below describes the use of the sign condition. Illustration:     77  BALANCE  PIC  S9 (6) V99.       .       .     I

Introduction to COBOL: In the year 1959, a new language named the COBOL ( CO mmon B usiness O riented L anguage) was introduced remembering the business purpose application

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

Environment Division: The Environment Division is the second division in the COBOL source program. It is mainly machine-dependent . The computer and all the peripheral dev

Display control verbs in Cobol

we have input file ,record layout is EMP ID (6 char) , EMP NAME (20 char), Designation (3 char),Salary (5 digit) Base Branch (10char) Grade (3 Alphanumeric). This is the input file

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.

DELETE STATEMENT : The file should be opened in the I-O mode. If the access is SEQUENTIAL, the INVALID KEY phrase must be specified. Rather than, the last input-output state

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

Illustration of the abbreviation: A few illustration of the abbreviation are given below: Illustration: The compound condition  AMOUNT GREATER THAN 499 AND AMOUNT L