Nested programs
A
COBOL program can nest, or contain, other COBOL programs. The nested
programs can themselves contain other programs. A nested program can be directly
or indirectly contained in a program.
There are four main advantages to nesting called programs:
- Nested programs provide a method for creating modular functions and
maintaining structured programming techniques. They can be used analogously
to PERFORM procedures, but with more structured control flow and
with the ability to protect local data items.
- Nested programs let you debug a program before including it in the
application.
- Nested programs let you compile an application with a single invocation of
the compiler.
- Calls to nested programs have the best performance of all the forms of
COBOL CALL statements.
The following example describes a nested structure that has directly and
indirectly contained programs:
Example: structure of nested programs
related tasks
Calling nested COBOL programs
related references
Scope of names
|