Data Reference and Name Scoping


The general concepts of Data Reference and Scoping of Names are important for the efficient and correct use of COBOL syntax. In particular, the scoping of names is important in using nested COBOL programs.

The first part of this section concentrates on the five methods of data reference:

  • Qualification
  • Subscripting
  • Reference modification
  • Function-identifier
  • User-defined data types

The rest of this section concentrates on the scoping of names.

Methods of Data Reference

References to data and procedures can be either explicit or implicit.

Every user-defined name in a COBOL program names a resource for solving a data processing problem. To use a resource, a statement in a COBOL program must contain a reference that uniquely identifies that resource. To ensure uniqueness of reference, a user-defined name can be qualified, subscripted, or reference modified. Before looking at this, however, you need to understand the term identifier.


In the syntax diagrams, the term identifier refers to a user-defined name that, if not unique in a program, must be followed by a syntactically correct combination of qualifiers, subscripts, or reference modifiers necessary for uniqueness of reference.

data-name-1, data-name-2

Can be a record-name.


Must be identified by an FD or SD entry in the Data Division. File-name-1 must be uniquely identifiable.

The following rules apply:

  • Duplication of data-names must not occur in those places where the data-name cannot be made unique by qualification.
  • In the same program, where data description entries for any two 01 level-number items have the same data-name, the external clause cannot be applied to either entry.
  • In the same Data Division, the data description entries for any two data items for which the same data-name is specified must not include the GLOBAL clause.

There are two special cases for the identifier: LINAGE-COUNTER and condition-name.



LINAGE-COUNTER Must be qualified each time it is referenced if more than one file description entry containing a LINAGE clause has been specified in the source program.

file-name-2 Must be identified by an FD entry in the Data Division. File-name-2 must be unique within this program.

Post Comments