Define the data that you use in input and output operations in the FILE SECTION.
Provide the following information about the data:
Data items defined in the FILE SECTION are not available to PROCEDURE DIVISION statements until the file has been successfully opened.
Programs in the same run unit can refer to the same COBOL file-names.
You can use the EXTERNAL clause for separately compiled programs. A file that is defined as EXTERNAL can be referenced by any program in the run unit that describes the file.
You can use the GLOBAL clause for programs in a nested, or contained, structure. If a program contains another program (directly or indirectly), both programs can access a common file by referencing a GLOBAL file-name.
You can share physical files without using external or global file definitions in COBOL source programs. For example, you can specify that an application has two COBOL file-names, but these COBOL files are associated with one system file:
SELECT F1 ASSIGN TO MYFILE. SELECT F2 ASSIGN TO MYFILE.
related concepts
Nested programs
related tasks
Sharing files between programs (external files)
related references
FILE SECTION entries