Rules for indexed tables, COBOL Programming


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 should be used for all levels. Therefore it will be an error if in the above the INDEXED phrase is used only for FACULTY and not for the DEPARTMENT and YEAR.

(2) The Index names cannot be used in combination with the subscripts. And hence, a reference as YEAR (F1, S2, S3) will be treated as an error as F1 is an index name but S2 and S3 are data names. Though, index names can be used in a combination with numeric positive integral literals. Therefore YEAR (F1, 2, 3) is valid as F1 is an index name, while 2 and 3 are numeric integral literals.

(3) Indexes are valid only for the tables where they have been identified. The Indexes for one table cannot be used for the other table. Therefore F1, D1 and Y1, being indexes for the table ENROLL-TABLE, cannot be used for other tables in similar program.

(4) The index names should be exclusive. The same index name should not be used for various levels of a table.

(5) The indexes should not appear anywhere in the DATA DIVISION except in the INDEXED phrase of the OCCURS clause. This means that the index names must be implicitly defined and must not be defined explicitly.

(6) The Indexes can be manipulated only by the SEARCH, SET and PERFORM statements. The value of an index is frequently known as the occurrence number. The internal presentation of the occurrence number is system dependent.

(7) An index can be coded plus or minus an integer literal for the relative addressing of the table elements. For illustration, YEAR (F1+1, D1-2, Y1-1) is valid. If F1, D1 and suppose that the value 1,3 and 4 respectively then this will refer to the third YEAR of the first DEPARTMENT of the second FACULTY.

(8) There can be more than one index for each level. For illustration, the ENROLL-TABLE can also be defined as


Posted Date: 10/18/2012 1:48:09 AM | Location : United States

Related Discussions:- Rules for indexed tables, Assignment Help, Ask Question on Rules for indexed tables, Get Answer, Expert's Help, Rules for indexed tables Discussions

Write discussion on Rules for indexed tables
Your posts are moderated
Related Questions
DELETE STATEMENT: The format of the delete statement is as shown below: DELETE   file-name RECORD   [  ;   INVALID   KEY  imperative-statement  ] Whenever the ACCESS MOD

RULES OF REDEFINES CLAUSE The rules shown below govern the use of the REDEFINES clause: (i) The level-number of data-name-1 and data-name-2 should be identical. (ii) Exce

PROGRAM FOR SIZE ERROR:   We have to write an easy program to elaborate the size error option. Identification division. Program- id. sizeerr. Environment division.

RULES OF MOVE VERB:  The Data movement is managed by the rules which are as shown below: (a) The contents of the identifier - 1 or the value of the literal - 1 is moved to

Illustration of Divide verb: (a) DIVIDE 5 INTO A. If the value of A is 20, then after execution of this statement the value of A will be 4. The older value of A will be los

FILE DESCRIPTION- FIXED-LENGTH RECORDS: The normal characteristics of a file are explained in the file description (FD) entry of the DATA DIVISION.

Record Description for the Variable-length Records: When the variable- length records consists of records of various lengths, each record type is to be explained at level 01 f

PERFORM STATEMENT:   The PERFORM statement can be used to execute the group of consecutive statements written elsewhere in the program. We refer to this group of statements a

FD Entry for variable-length Records: The RECORDS CONTAINS and BLOCK CONTAINS clause are quite dissimilar in the case of files with variable- length records. The syntax of the

Common form of the READ statements: Format 1 is the common form of the READ statements. Format 2 is used when the access mode is either random or dynamic. For illustration,