Occurs - indexed by program, COBOL Programming

OCCURS - INDEXED BY PROGRAM:

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.

p-1.

  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.

p-2.

        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.

p-3.

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

              stop run.     

get-para.

  display(1 1) erase.

  display(3 5) "Name : ".

  accept name (i).

  display(5 5) "Salary : ".

  accept sal (i).

init-para.

               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
The LENDER Bank offers mortgages on homes valued up to $500,000. The required down payment is calculated as follows: 4% of the first $60,000 borrowed 8% of the next $30,000 borro

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 f

WRITE STATEMENT: The WRITE Statement verb releases a record in an output file. The syntax for the WRITE statement can be unlike depending on the output device and the medium us

File Activity: The file activity is a measure of the proportion of records processed during an update run. Therefore we define the activity ration as shown below. Activi

SIMPLE MERGE VERB: Like sorting, the merging of files is often required in different commercial application. It is likely to merge two or more files with the help of one MERGE

PROGRAM USING OCCURS CLAUSE: We have to write a simple program to demonstrate Occurs Clause. Get the employee details for 3 persons and compute the total salary. identifica

DECLARATIVE and FILE STATUS Clause: The input-output exception condition in the situation of a direct access files can be handled by a declarative procedure in a manner simila

MULTI-DIMENSIONAL TABLES: The type of table which has been considered above is known as one-dimensional table. Whenever a table is such that each of its elements in turn is a

NEGATED SIMPLE CONDITION: Any of the easy condition explained can be preceded by the logical operator NOT. The consequence of placing the operator NOT before an easy condition

Format for COBOL Programs: The COBOL is a high-level language. Therefore, a COBOL program can be executed on a computer for which a COBOL compiler exists. The compiler transla