Compaq AAQ2G1FTK Marine Radio User Manual


 
Interprogram Communication
12.5 Communicating with Contained COBOL Programs
Figure 124Dening Data Names in the Linkage Section
IDENTIFICATION DIVISION.
PROGRAMID. MAINPROG.
ENVIRONMENT DIVISION.
DATA DIVISION.
FILE SECTION.
01 FILERECORD PICTURE ...
WORKINGSTORAGE SECTION.
01 WORKRECORD PICTURE ...
IDENTIFICATION DIVISION.
PROGRAMID. SUB.
ENVIRONMENT DIVISION.
DATA DIVISION.
FILE SECTION.
WORKINGSTORAGE SECTION.
01 FRECORD PICTURE ...
01 WRECORD PICTURE ...
LINKAGE SECTION.
PROCEDURE DIVISION USING FRECORD
WRECORD.
PROCEDURE DIVISION.
BEGIN.
BEGIN.
.
.
.
EXIT PROGRAM.
CALL "SUB" USING FILERECORD
WORKRECORD.
STOP RUN.
1
4
2
3
ZK1477GE
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 1213