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
PROGRAM FOR INVENTORY  We have to write a program to update the inventory file. Consider 2 files,viz, invfile an tranfile. Invfile has 3 fields pno,name,qty. Tranfile has 3 fil

There are some restrictions when these procedures are used. (i) The Procedure should not contain any SORT/MERGE statement. (ii) An explicit transfer of the control outside

Direct Organization: Besides the relative or indexed organization, also a direct access file can be designed to have what is termed as direct organization.  In this organizati

Common form of the READ statements: Format 1 is the common form of the READ statements. Format 2 is used when the access mode is either random or dynamic. For illustration,

PROGRAM FOR DIVIDE VERB:   We have to write an easy program to elaborate DIVIDE verb. You can also use edit characters in the program. Identification division. Program-

File- Section &Working-Storage Section: a) FILE SECTION: The FILE SECTION includes the explanation of all data items that must be read from or written onto some external

CLOSE STATEMENT: When the processing of a file is completed, then the file may be closed. This is completed with the help of the CLOSE-verb. The form of the CLOSE statement is

PROGRAM TO DEMONSTRATE MERGE VERB: The two files for which a record having 2 fields viz. Account Number and Name are already available. Now Merge these two files and create a

PROGRAMS FOR REDEFINES CLAUSE: We have to write a simple program to explain the REDEFINES clause at 01 level. identification division. program- id. Redef. environment

PROGRAM FOR PERFORM ...UNTIL We have to write a program to find the sum of "n" natural numbers. Identification division. Program- id. PerfUntil. Environment division.