Cobol has compile-time binding for variables, sometimes called static scope.
Inside this, Cobol supports several levels of visibility in programs:
"External" variables are the equivalent of a common Fortran or assembler section; they are truly global.
The variables "Global program area" declared in the working repository as global are visible for the entire program in which they are declared and in all nested subprograms contained in this program.
Program Scope variables declared in the working repository are visible to the entire program in which they are declared.
Program Scope variables declared in local storage are visible to the entire program in which they are declared, but are deleted and reinitialized with each call. Think of an area sorted by sections.
The "nested program area" Cobol does not distinguish between programs and functions / procedures; its equivalence of a procedure or function is called a program. A program can contain an infinite number of programs, and the variables of each of them are visible only within the limits of this separate program. You can consider this as an area of functions / procedures.
The OO extensions that many vendors have, and the 2002 standard, define the traditional scope and scope of a public / protected / private object.
Cobol is as old as Radar, Laser and Scuba, can we stop cutting it?
source share