The GLOBAL clause specifies that a data-name, a file-name, or a report-name is a global name. A global name is available to every program contained within the program which declares it.
General Format
Syntax Rules
- The GLOBAL clause can be specified only in data description entries whose level-number is 01 in the File Section or the Working-Storage Section, file description entries, or report description entries.
The GLOBAL clause can also be specified in the Linkage Section.
- 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.
- If the SAME RECORD AREA clause is specified for several files, the record description entries or the file description entries for these files must not include the GLOBAL clause.
General Rules
- A data-name, file-name or report-name described using a GLOBAL clause is a global name. All data-names subordinate to a global name are global names. All condition-names associated with a global name are global names.
- A statement in a program contained directly or indirectly within a program which describes a global name can reference that name without describing it again. See the topic Scope of Names in the chapter Concepts of the COBOL Language.
- If the GLOBAL clause is used in a data description entry which contains the REDEFINES clause, it is only the subject of that REDEFINES clause which possesses the global attribute.