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
Example of Special-names: Consider the illustration: Let the SPECIAL-NAMES paragraph be as shown: SPECIAL-NAMES. CHANNEL 1 IS PAGE-TOP. The Channel is related with the t

Major difference between file and array how does record read from array and file why we are not preparing array for real time

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

.(Period or Decimal Point) : The period may be used to insert a decimal point and may not come into view more than once. Both the period and V cannot appear in similar picture

CONDITIONS-NAME CONDITION:   The condition name is an entity which itself is a condition and these can have either a true or false value. Though, a condition name cannot be d

INDEXED SEQUENTIAL FILES: In the indexed sequential files which are also known as indexed files, the records are stored in the sequence order generally in ascending order. In

Evaluate is like a case statement & Evaluate  stamenet can be used to replace nested Ifs. The difference b/w EVALUATE and case is that there is no 'break' is required for EVALUATE

When using the accept verb in cobol is it possible to assign something other then "SYSIN" for a ddname?

Group Item as Operand in the Relational Condition: Whenever an operand of a relational condition is the group item, the item is then considered to be an alphanumeric field. Th

SEQUENTIAL FILES WITH THE VARIABLE-LENGTH RECORDS: The Magnetic - tape or disk files can hold variable-length records. In this situation the file can have records with various