Types of names
In addition to identifying a resource, a name can have global or local attributes. Some names are always global, some names are always local, and some names are either local or global depending on specifications in the program in which the names are defined.
- For programs
- A global name can be used to refer to the resource with which it is associated both:
- From within the program in which the global name is defined
- From within any other program that is contained in the program that defines the global name
Use the GLOBAL clause in the data description entry to indicate that a name is global. For more information about using the GLOBAL clause, see GLOBAL clause.
A local name can be used only to refer to the resource with which it is associated from within the program in which the local name is defined.
By default, if a data-name, a file-name, a record-name, a record-key-name, or a condition-name definition in a data description entry does not include the GLOBAL clause, the name is local.
Restriction: Specific rules sometimes prohibit specifying the GLOBAL clause for certain data description, file description, or record description entries.
The following list indicates the names that you can use and whether the name can be local or global:
- data-name
- data-name assigns
a name to a data item.
A data-name is global if the GLOBAL clause is specified either in the data description entry that defines the data-name or in another entry to which that data description entry is subordinate.
- file-name
- file-name assigns
a name to a file connector.
A file-name is global if the GLOBAL clause is specified in the file description entry for that file-name.
- record-name
- record-name assigns
a name to a record.
A record-name is global if the GLOBAL clause is specified in the record description that defines the record-name, or in the case of record description entries in the FILE SECTION, if the GLOBAL clause is specified in the file description entry for the file name associated with the record description entry.
- record-key-name
- record-key-name assigns a name to a key associated
with an indexed file.
You can define record-key-name by using the SOURCE phrase in the ALTERNATE RECORD KEY clause, or using the RECORD KEY clause of the file control entry for an indexed file. A record-key-name is global if the GLOBAL clause is specified in the file description entry for that file.
Restriction: record-key-name is supported for STL file system only. - condition-name
- condition-name associates
a value with a conditional variable.
A condition-name that is defined in a data description entry is global if that entry is subordinate to another entry that specifies the GLOBAL clause.
A condition-name that is defined within the configuration section is always global.
- program-name
- program-name assigns
a name to an external or internal (nested) program. For more information,
see Conventions for program-names.
A program-name is neither local nor global. For more information, see Conventions for program-names.
- section-name
- section-name assigns
a name to a section in the PROCEDURE DIVISION.
A section-name is always local.
- paragraph-name
- paragraph-name assigns
a name to a paragraph in the PROCEDURE DIVISION.
A paragraph-name is always local.
- basis-name
- basis-name specifies the name of source text that is be included by the compiler into the source unit. For details, see BASIS statement.
- library-name
- library-name specifies the COBOL library that the compiler uses for including COPY text. For details, see COPY statement.
- text-name
- text-name specifies the name of COPY text to be included by the compiler into the source unit. For details, see COPY statement.
- alphabet-name
- alphabet-name assigns
a name to a specific character set or collating sequence, or both,
in the SPECIAL-NAMES paragraph of the ENVIRONMENT DIVISION.
An alphabet-name is always global.
- class-name (of data)
- class-name assigns
a name to the proposition in the SPECIAL-NAMES paragraph of the ENVIRONMENT
DIVISION for which a truth value can be defined.
A class-name is always global.
- mnemonic-name
- mnemonic-name assigns
a user-defined word to an implementer-name.
A mnemonic-name is always global.
- symbolic-character
- symbolic-character
specifies a user-defined figurative constant.
A symbolic-character is always global.
- index-name
- index-name assigns
a name to an index associated with a specific table.
If a data item that possesses the global attribute includes a table accessed with an index, that index also possesses the global attribute. In addition, the scope of that index-name is identical to the scope of the data-name that includes the table.
- type-name
-
type-name names a user-defined data type that can be used in a TYPE clause to
define a data item.
A type name is global if the GLOBAL clause is specified in the data description entry by which the type-name is declared. The GLOBAL attribute of a type-name is restricted to the type-name, and is not acquired by a data item that is defined using the type-name in a TYPE clause.