These are interesting things on COBOL. Surely if you implement these in your development projects your productivity will increase.
Within a main program and each of its contained subprograms, data and files are normally private, which means that they are accessible only to the program in which they are contained. However, COBOL has provisions for sharing data and files among a main program and its subprograms.
Procedure names and paragraph names are private to a program. They can not be shared by other programs.But, program names must be unique.
PROGRAM-ID. program-name IS COMMON PROGRAM.
A program with COMMON, can be called by all other programs, not limited to by the program containing it.It can not be called by outside programs, since its load is not present in other load module.
In mainframe, a subprogram can be called by itself. It is called recursive calling
01 data-name IS GLOBAL
Means data item is global to all programs
FD file-name IS GLOBAL
File name and record names are global to all porgrams
A declaration of EXTERNAL for a file means that anywhere in the run unit that the same file is declared (with the same name and the attribute EXTERNAL), the reference is to the same exact file.
FD file-name IS EXTERNAL
You must define the file in any program that references it. However, an external file does not really “belong” to any particular program—it belongs to the whole run unit.