Interprogram Communication
12.5 Communicating with Contained COBOL Programs
Figure 12–4 Defining Data Names in the Linkage Section
IDENTIFICATION DIVISION.
PROGRAM−ID. MAINPROG.
ENVIRONMENT DIVISION.
DATA DIVISION.
FILE SECTION.
01 FILE−RECORD PICTURE ...
WORKING−STORAGE SECTION.
01 WORK−RECORD PICTURE ...
IDENTIFICATION DIVISION.
PROGRAM−ID. SUB.
ENVIRONMENT DIVISION.
DATA DIVISION.
FILE SECTION.
WORKING−STORAGE SECTION.
01 F−RECORD PICTURE ...
01 W−RECORD PICTURE ...
LINKAGE SECTION.
PROCEDURE DIVISION USING F−RECORD
W−RECORD.
PROCEDURE DIVISION.
BEGIN.
BEGIN.
.
.
.
EXIT PROGRAM.
CALL "SUB" USING FILE−RECORD
WORK−RECORD.
STOP RUN.
1
4
2
3
ZK−1477−GE
12.5 Communicating with Contained COBOL Programs
A contained COBOL program is a subprogram nested in another COBOL program
(the containing program). The complete source of the contained program is found
within the containing program. A contained program can also be a containing
program.
A COBOL containing/contained program provides you with program and data
attributes that noncontained COBOL programs do not have. These attributes,
described in the next several sections, often allow you to more easily share and
more conveniently access COBOL data items and other program resources.
This COBOL programming and data structuring capability encourages modular
programming. In modular programming, you divide the solution of a large data
processing problem into individual parts (the contained programs) that can be
developed relatively independently.
Consequently, the use of the COBOL containing/contained block structure as
a modular programming design can increase program efficiency and assist in
program modification and maintainability.
The contained program uses all calling procedures described in Sections 12.3
and 12.4. However, when a contained program includes the COMMON clause (a
program attribute) and the GLOBAL clause (a data and file trait), the additional
rules described in the following sections apply.
Interprogram Communication 12–13
Содержание COBOL AAQ2G1FTK
Страница 22: ......
Страница 30: ......
Страница 94: ......
Страница 110: ......
Страница 146: ......
Страница 180: ......
Страница 194: ...Processing Files and Records 6 1 Defi...
Страница 300: ......
Страница 490: ......
Страница 516: ......
Страница 517: ......
Страница 530: ......
Страница 534: ......
Страница 590: ......
Страница 620: ......