Interprogram Communication
12.2 COBOL Program Attributes
When an INITIAL clause is not present, the status of the files and internal
program data are the same as when the called program was exited.
The initial attribute is attained by specifying the INITIAL clause in the program’s
PROGRAM-ID paragraph. For example:
IDENTIFICATION DIVISION.
PROGRAM-ID.
TEST-PROG
INITIAL.
12.2.2 The EXTERNAL Clause
Storage of data can be external or internal to the program in which the data
is declared. A file connector can also be external or internal to the program in
which it is defined.
External data or files can be referenced by every program in a run unit that
describes that data or those files as external.
The EXTERNAL clause indicates that data or a file is external. This clause is
specified only in File Description entries in the FILE SECTION or in Record
Description entries in the WORKING-STORAGE Section. The EXTERNAL clause
is one method of sharing data between programs. For example, in the following
Working-Storage Section entry, the data items in RECORD-1 are available to
any program in the image that also describes RECORD-1 and its data items as
EXTERNAL:
01
RECORD-1 EXTERNAL.
03
ITEMA
PIC X.
03
ITEMB
PIC X(20).
03
ITEMC
PIC 99.
Note
EXTERNAL files and data must be described identically in all programs
in which they are defined.
12.3 Transferring Flow of Control
You control a multiple program run unit sequence by executing the following:
•
A controlling CALL statement in the calling program (main or subprogram)
•
An EXIT PROGRAM statement in the called subprogram
Contained COBOL programs have additional communication mechanisms that
are explained in Section 12.5.
12.3.1 The CALL Statement
A CALL statement transfers the run unit’s flow of control from the calling
program to the beginning of the called subprogram’s Procedure Division. See the
Compaq COBOL Reference Manual for the CALL statement format.
The first time the called subprogram gains the flow of control, it is in its initial
state. Thereafter, each time it is called its state is the same as the last exit from
that program, except when: ( 1 ) the called program has the INITIAL clause, or
( 2 ) the calling program cancels the called program.
Interprogram Communication 12–5
Содержание COBOL AAQ2G1FTK
Страница 22: ......
Страница 30: ......
Страница 94: ......
Страница 110: ......
Страница 146: ......
Страница 180: ......
Страница 194: ...Processing Files and Records 6 1 Defi...
Страница 300: ......
Страница 490: ......
Страница 516: ......
Страница 517: ......
Страница 530: ......
Страница 534: ......
Страница 590: ......
Страница 620: ......