Rules for occurs clause, COBOL Programming

Assignment Help:

RULES FOR OCCURS CLAUSE:

The rules apply for the OCCURS clause and the subscripts are as shown below.

(1) The integer in the OCCURS clause should be a positive integer.

(2) The OCCURS clause can be identified for an elementary item or for a group item. The clause causes adjoining fields to be set up internally. Each field is alike to the elementary or group item for which the OCCURS clause has been identified. The number of fields which are set up is equivalent to the integer in the OCCURS clause. The OCCURS clause cannot be identified for an item whose level numbers are 01, 66, 77 or 88.

(3) Whenever a data name is defined with occur clause which the data name as well as any of its subordinate items cannot be referred to in the PROCEDURE DIVISION without a subscript. It may be a positive integer constant, a numeric integral data or an arithmetic expression. For illustration, an element of the above INCOME-TAX-RATE table, can be referred to the PROCEDURE DIVISION as

      TAX-RATE (I)    or as (3*J)

In the initial situation, a data name I has been used as the subscript. If the current value of I is, 5, then the TAX-RATE (I) will refer to the fifth element of the table. In the second situation, an arithmetic expression has been used as the subscript. The value of the expression is used to specify the particular element of the table. Therefore, if the present value of J is 1, TAX-RATE (3*J) will refer to the third element of the table.

(4) The maximum value which a subscript can take is the one specified in the OCCURS clause. For any table, the minimum value of a subscript is implicitly supposed to be 1. By the range of a subscript we mean the range of values from 1 to the maximum possible value of the subscript. In the above illustration, the range of the subscript is 1-10. If during the execution of a program, the value of subscript is found to be outside its range, then an execution error occurs and the program is finished by the system.

(5) The subscripts must be enclosed in a set of parentheses. In common, blank space may not follow the left parenthesis while there should be a space preceding the left parenthesis and following the right one.

(6) When a data name with the OCCURS clause needs any qualification by its higher level, the subscripts to be written after the final qualified name. For illustration, if TAX-RATE must be qualified, it should appear as TAX-RATE OF INCOME-TAX-RATE (I) and not as the TAX-RATE (I) OF INCOME-TAX-RATE.

(7) Whenever an entry is defined with the OCCURS clause, the VALUE clause cannot be identified for that specific item or any item subordinate to it.

(8) The REDEFINES clause cannot appear in similar data description entry that contains an OCCURS clause. Though, the REDEFINES clause can appear for a group item whose subordinate items are defined with occur clause.

(9) The OCCURS clause can appear in the data description entry in any order. 


Related Discussions:- Rules for occurs clause

Blank insertion and zero insertion, B (Blank Insertion) : The occurren...

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:

Kirat da satikar, bal majduri ik kanuni apradh hai is de bavjud bache ,ghra...

bal majduri ik kanuni apradh hai is de bavjud bache ,ghra,hotla,road, kam karn lai majbur han bacheya te mapeya nu parhai val prerit karn lai ik bashan teyar kro

Rules for indexed tables, RULES FOR INDEXED TABLES: The rules of index...

RULES FOR INDEXED TABLES: The rules of indexing a table with an INDEXED phrase are as shown below: (1) If indexing is completed for any one level of a table, then indexing

Minus sign - edit characters for numeric data , Minus sign - edit character...

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

Close statement - sequential files, CLOSE statement: The simplified sy...

CLOSE statement: The simplified syntax of the CLOSE statement is as shown below:   CLOSE          file-name-1   [WITH   LOCK   ]                         [  , file-

Floating insertion - , Floating Insertion   The currency symbol ($) c...

Floating Insertion   The currency symbol ($) can emerge in multiples on the left-hand side of the picture. In this situation the character will be treated in similar way as t

Rick, How do I move a single QUOTE to a field or set the value clause? "''...

How do I move a single QUOTE to a field or set the value clause? "''" does not work?

Illustration of subtract verb, Illustration of Subtract verb: (a) SUBT...

Illustration of Subtract verb: (a) SUBTRACT A FROM B. This illustration means that the value of A will be subtracted from the value of B and the subtracted result will be s

Indexed tables, INDEXED TABLES: The OCCURS clause that is used to defi...

INDEXED TABLES: The OCCURS clause that is used to define tables can optionally have an INDEXED phrase. This phrase involves the names of data items which are to be used as sub

Program to find interest on bank deposits, PROGRAM TO FIND INTEREST ON BANK...

PROGRAM TO FIND INTEREST ON BANK DEPOSITS: We have to write a program to find interest on deposits. The criteria is given below : identification division. program-

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