ILE COBOL Language Reference
When a program, program B, is directly or indirectly contained within
another program, program A, both programs may define objects using the same
user-defined word. (Objects include, for example, a condition-name, a
data-name, a file-name, a record-name, a function name, or a
type-name.) When such a duplicated name is referenced in program B, the
following rules are used to determine the referenced object:
- The referenced object is identified from the set of all names which are
defined in program B and all global names defined in the directly containing
program A and in any programs which directly or indirectly contain program
A. Using this set of names, the normal rules for qualification and any
other rules for uniqueness of reference are applied until one or more objects
is identified.
- If only one object is identified, it is the referenced object.
- If more than one object is identified, no more than one of them can have a
name local to program B unless each reference to them can be made unique with
appropriate qualification. If zero or one of the objects has a name
local to program B, the following rules apply:
- If the name is declared in program B, the object in program B is the
referenced object.
- Otherwise, if program A is contained within another program, the
referenced object is:
- The object in program A if the name is declared in program A.
- The object in the containing program if the name is not declared in
program A and is declared in the program containing program A. This
rule is applied to further containing programs until a single valid object has
been found.
- When the referenced object is a function, the function definition
sometimes requires the programmer to specify a value or set of values for one
or more arguments that determine the value of the function for that particular
reference. The term function-identifier refers to the term
used to reference an intrinsic function within the Procedure Division of a
COBOL source program. The data item represented by a function is
uniquely identified by a function-name with its arguments, if any.
Related Information:
[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.