Problem:
COBOL program structure
A COBOL source program is a syntactically correct set of COBOL statements.
Resolution:
Object program
An object program is a set or group of executable machine language
instructions and other material designed to interact with data to provide
problem solutions. An object program is generally the machine language
result of the operation of a COBOL compiler on a source program.
Nested programs
A nested program is a program that is contained in another program.
These contained programs can reference some of the resources of the
programs that contain them. If program B is contained in program A, it
is directly contained if there is no program contained in program A that
also contains program B. Program B is indirectly contained in program A
if there exists a program contained in program A that also contains
program B.
Common programs
A program that despite being directly contained in another program,
can be called from any program, directly or indirectly contained in
that other program.
Run unit
A run unit is one or more object programs that interact with one another
via COBOL CALL statements which function at run time as an entity to
provide problem solutions.
Sibling program
Sibling programs are programs that are directly contained by the same
program.
With the exception of the COPY and REPLACE statements and the end program
header, the statements, entries, paragraphs, and sections of a COBOL source
program are grouped into the following four divisions:
* Identification Division
* Environment Division
* Data Division
* Procedure Division
The end of a COBOL source program is indicated by the END PROGRAM header.
If there are no nested programs, the absence of additional source program
lines also indicates the end of a COBOL program.
Structure of Nested Programs
A COBOL program can "contain" other COBOL programs. The contained programs
can themselves contain yet other programs. A contained program can be
directly or indi
rectly contained in a program.
Figure 99 describes a nested program structure with directly and indirectly
contained programs.
__________________________________________________________________________
| |
| __________Id Division. |
| X is the outermost program | Program_Id. X. |
| and directly contains X1 and _________>| Procedure Division. |
| X2, and indirectly contains | Display "I'm in X" |
| X11 and X12 | Call "X1" |
| | Call "X2" |
| | Stop Run. |
| | ______Id Division. |
| X1 is directly contained | | Program_Id. X1. |
| in X and directly _________|_>| Procedure Division. |
| contains X11 and X12 | | Display "I'm in X1" |
| | | Call "X11" |
| | | Call "X12" |
| | | Exit Program. |
| | | ___Id Division. |
| X11 is directly | | | Program_Id. X11. |
| contained in X1 ________|__|_>| Procedure Division. |
| and indirectly | | | Display "I'm in X11"|
| contained in X | | | Exit Program. |
| | | |___End Program X11. |
| | | ___Id Division. |
|
X12 is directly
#EnterpriseDeveloper
#MFDS




