Occurs clause, COBOL Programming

Assignment Help:

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}


Related Discussions:- Occurs clause

Compute verb, COMPUTE VERB: The COMPUTE verb is very powerful. All the...

COMPUTE VERB: The COMPUTE verb is very powerful. All the evaluations performed by the other 4 verbs can also be completed easily by using the COMPUTE verb. Its normal format i

Rules for constructing an arithmetic expression, Rules for constructing an ...

Rules for constructing an Arithmetic Expression: The rules for constructing an arithmetic expression are as shown below: (i) When an arithmetic expression specifies a calcu

Program for if -else, PROGRAM FOR IF -ELSE: We have to write a program...

PROGRAM FOR IF -ELSE: We have to write a program to check whether the given number is ODD or EVEN. You can use IF..ELSE. Identification division. Program- id. IfElse.

Program using occurs clause, PROGRAM USING OCCURS CLAUSE: We have to w...

PROGRAM USING OCCURS CLAUSE: We have to write a simple program to demonstrate Occurs Clause. Get the employee details for 3 persons and compute the total salary. identifica

Buffers - file characteristics, Buffers: The Modern computers are able...

Buffers: The Modern computers are able of handling I-O operations independent of the CPU by means of the hardware termed as data channel. For illustration, if two buffers a

Program for condition names , PROGRAM FOR CONDITION NAMES: We have to ...

PROGRAM FOR CONDITION NAMES: We have to write a simple program to demonstrate Condition names usage.  identification division.   program- id.   environment division.

Merge verb with output procedure, MERGE VERB WITH OUTPUT PROCEDURE: Li...

MERGE VERB WITH OUTPUT PROCEDURE: Like the sort verb, the merge verb can also have an output procedure. The syntax of the MERGE verb is as shown below:   The r

Rewrite statement - relative files, REWRITE STATEMENT: The REWRITE st...

REWRITE STATEMENT: The REWRITE statement has the format for a relative file as shown below, REWRITE record-name  [ FORM identifier ]

Write statement - indexed files, WRITE STATEMENT: The records are wri...

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)

Example of perform statement, Example of Perform statement: PERFORM BE...

Example of Perform statement: PERFORM BEGIN-CALCULATION THRU END-CALCULATION. Assume, BEGIN-CALCULATION and END-CALCULTION is paragraph names. The execution of the PERFORM

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd