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
READ STATEMENT: The aim of this verb is to make available the next logical record from the input file. It is important to note the meaning of the "next" logical record in the

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

Sign - Picture clause: The numeric data item can be signed or unsigned. If a numeric data is regarded as unsigned then during the execution these unsigned data items are treat


DATA RECORD CLAUSE: The DATA RECORD clause, documents the record names defined for the file. For illustration, DATA RECORDS ARE REC-1, REC-2, REC-3 that means there are 3diffe

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

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:

IF ... ELSE STATEMENT: We are familiar with an easy form of the IF statement. The common form of the IF statement is as shown below: Each of the statement-1 and statem

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

Rules of read statements: The next record is identified according to the rules as shown below: (i) Whenever the READ NEXT statement is the initial statement to be executed