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
ON SIZE ERROR OPTION:   If after an arithmetic expression, the result exceeds the highest value which can be accommodated in the result; this error is termed as size error. T

Example of read statement: Illustration: READ OLD-MASTER AT END MOVE ZERO TO END-OF-RECORDS. As a result of this statement, generally the next record from the OLD-MAST

Minus sign - edit characters for numeric data: The minus sign can appear either at the leftmost or rightmost location of the picture. If an item is negative, a minus sign will

PROGRAM TO DEMONSTRATE SORT VERB: The file for which a record having 2 fields, viz., Account Number and Name is already available. Sort the file based on the ascending order o

INPUT-OUTPUT SECTION: This section holds information regarding the files to be used in the program. There are 2 paragraphs in this section- FILE-CONTROL & I-O-CONTROL. The

/ (Slash Insertion): The edit character slash (/) also termed as virgule or stroke, may appear anyplace in the picture. When used, it will be inserted. More than one slash can

I uploaded a file from PC to Mainframe, variable LRCL 256. In my COBOL program I defined it as FD INPUT-FILE LABEL RECORDS ARE OMITTED BLOCK CONTAINS 0 RECORDING MODE

B (Blank Insertion) : The occurrence of a B anyplace in the picture will insert a space character in the edited data. There can be more than one B in the picture. Examples:

Illustration of simple sort verb: Illustration: Suppose that we have a card file with the following records description in the data division. The names of the work fil

WRITE STATEMENT: The records are written to be logical place as determined from the value of the record key. The INVALID KEY condition occurs in the cases shown below: (i)