GLOBAL clause
The GLOBAL clause specifies that the file connector named by a file-name is a global name. A global file-name is available to the program that declares it and to every program that is contained directly or indirectly in that program.
The GLOBAL clause can be specified in the same data description entry as the TYPEDEF clause. The scope of the clause applies to the type-name only, and not to any data items which are defined using a global type-name with a TYPE clause.
A file-name is global if the GLOBAL clause is specified in the file description entry for that file-name. A record-name is global if the GLOBAL clause is specified in the record description entry by which the record-name is declared 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. Such record description entries may describe a type-name. For details on using the GLOBAL clause, see Using data in input and output operations and Scope of names in the COBOL for Linux® on x86 Programming Guide.
Two programs in a run unit can reference global file connectors in the following circumstances:
- An external file connector can be referenced from any program that describes that file connector.
- If a program is contained within another program, both programs can refer to a global file connector by referring to an associated global file-name either in the containing program or in any program that directly or indirectly contains the containing program.