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

Program for add corresponding, PROGRAM FOR ADD CORRESPONDING: We have ...

PROGRAM FOR ADD CORRESPONDING: We have to write a simple program to demonstrate Add Corresponding.   identification division.   program- id.   environment division.

Picture specification - picture clause, PICTURE specification: The siz...

PICTURE specification: The size of a group item is equivalent to the total of the sizes of all the subordinate elementary items. The group item class is alphanumeric. The i

Program for indexed sequential file creation , PROGRAM FOR INDEXED SEQUENTI...

PROGRAM FOR INDEXED SEQUENTIAL FILE CREATION: We have to write a program to create an Indexed Sequential File in a dynamic mode for Student particulars. Suppose just 3 fields:

Data record clause - and code-set clause, DATA RECORD CLAUSE: The DATA...

DATA RECORD CLAUSE: The DATA RECORD clause, documents the record names defined for the file. For illustration, DATA RECORDS ARE REC-1, REC-2, REC-3 that means there are 3diffe

Declarative and file status clause, DECLARATIVE and FILE STATUS Clause: ...

DECLARATIVE and FILE STATUS Clause: The input-output exception condition in the situation of a direct access files can be handled by a declarative procedure in a manner simila

Block contains and records contains clause, BLOCK CONTAINS CLAUSE: Int...

BLOCK CONTAINS CLAUSE: Integer -1 of the BLOCK CONTAINS clause indicates the block size either in terms of records or in terms of characters. For illustration, BLOCK CONTAINS

Numeric literals - cobol program, Numeric -   Literals : The numeri...

Numeric -   Literals : The numeric literal can be created with the help of digits only. It can have a sign (+ or -) and can also have a decimal point. If no sign is specifi

Column and field in cobol program, Column and Field in COBOL program: ...

Column and Field in COBOL program: In COBOL there are 2 types of entries termed as margin A and margin B entries. The Margin A entries start from the column 8, 9, 10 or 11 and

Cobol words, COBOL Words: The COBOL word can be formed by using the ch...

COBOL Words: The COBOL word can be formed by using the characters as shown below: 0-9 A-Z (a-z) - (hyphen) The rules below should be hold in forming the COBOL words.

Example of condition names, Example of condition names: The illustrati...

Example of condition names: The illustration below is of the use of the condition names  77  MARITAL-STATUS     PIC    9   88  SINGLE    VALUE    IS     ZERO   88  MA

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