The Using Phrase; Transfer Of Control Flow From A Main Program To Multiple Subprograms - Compaq COBOL AAQ2G1FTK User Manual

Compaq computer accessories user manual
Table of Contents

Advertisement

Figure 12–2 Transfer of Control Flow from a Main Program to Multiple Subprograms
IDENTIFICATION DIVISION.
IDENTIFICATION DIVISION.
PROGRAM−ID. MAINPROG.
PROGRAM−ID. SUB.
ENVIRONMENT DIVISION.
ENVIRONMENT DIVISION.
DATA DIVISION.
DATA DIVISION.
PROCEDURE DIVISION.
PROCEDURE DIVISION.
1
BEGIN.
BEGIN.
2
CALL "SUB".
STOP RUN.
10
The GLOBAL clause (see Section 12.5.2)

12.4.1 The USING Phrase

To access a calling program's Data Division, use a CALL statement in the calling
program and a Procedure Division USING phrase in the called program. The
USING phrases of both the CALL statement and the Procedure Division header
must contain an equal number of data names. (See Figure 12–3.)
12.4 Accessing Another Program's Data Division
Sharing Execution Control
from a Main Program to Multiple Subprograms
IDENTIFICATION DIVISION.
PROGRAM−ID. SUBA.
ENVIRONMENT DIVISION.
DATA DIVISION.
PROCEDURE DIVISION.
3
BEGIN.
4
CALL "SUBA".
CALL "SUBB".
EXIT PROGRAM.
EXIT PROGRAM.
9
Interprogram Communication
IDENTIFICATION DIVISION.
PROGRAM−ID. SUBB.
ENVIRONMENT DIVISION.
DATA DIVISION.
PROCEDURE DIVISION.
5
7
BEGIN.
6
.
.
.
EXIT PROGRAM.
8
Interprogram Communication 12–9
ZK−1474−GE

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COBOL AAQ2G1FTK and is the answer not in the manual?

Table of Contents