Occurs clause, COBOL Programming

Occurs Clause:

Let us establish tables with the help of an illustration. Assume that there are ten different types of income-tax rates that are read from some input medium and these rates are stored in a table named INCOME-TAX-RATE. The DATA DIVISION entries for this table may be as

As shown below:

219_Occurs Clause.png

Clearly, there are ten different data names, like TAX-RATE-1, TAX-RATE-2 etc., in the table namely the INCOME-TAX-RATE and each of these items is of two digits. As the picture of all these items are similar, these can be explained by having just one entry and then specifying that the explanation is to be repeated ten times. This is completed as shown below:

01              INCOME-TAX-RATE

02  TAX-RATE    PIC  99  OCCURS  10  TIMES.

This OCCURS clause specifies that the table named INCOME-TAX-RATE is having ten elements and each one is of two digits. In order to refer to an individual element exclusively we should use a subscript. The initial element is referred to as TAX-RATE (1), the second one as TAX-RATE (2), the seventh one as TAX-RATE (7), and so on. TAX-RATE (1), TAX-RATE (2) etc., are termed as subscripted data names and 1, 2 etc., that are enclosed in parentheses and are known as subscripts.

The common format of OCCURS clause is as shown below:

  {OC}            integer        TIMES

  {OCCURS}

Posted Date: 10/18/2012 1:28:00 AM | Location : United States







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

Write discussion on Occurs clause
Your posts are moderated
Related Questions
PROCEDURE DIVISION statements for the relative files: The statements OPEN, CLOSE, READ, WRITE and REWRITE that are available for sequential files are also available for the re

Illustration of indexed tables: Index items defined through the INDEXED phrase of the OCCURS clause are one type of indexes. There can be other type of index items that are de

OPEN STATEMENT: Whenever a READ or a WRITE operation is executed on a file, then it should be open. The opening of a file may be completed with the help of the OPEN verb. With

SUBTRACT VERB: The SUBTRACT verb is used to subtract one, or the sum of two or more numbers from one or more numbers and to store the result. The form of the SUBTRACT verb

Example of constructing an arithmetic expression: An arithmetic expression may be proceeded by a + or - sign. These operations are known as unary + or unary - operators. Il

.(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

Structure of a COBOL Program: Every COBOL program should have the 4 divisions in the order in which they are specified below: 1. Identification division 2. Environment D

PROGRAM FOR MULTIPLY VERB: We have to write a simple program to elaborate MULTIPLY verb. You can also use the edit characters in the program. Identification division. Pr

, (Comma) : A comma, whenever used in a picture, is considered as an insertion character and inserted wherever it become visible. There can be more than one comma in the pictu

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