Compaq COBOL AAQ2G1FTK User Manual

Page 448

Advertising
background image

Interprogram Communication
12.5 Communicating with Contained COBOL Programs

Figure 12–7 Executing Declaratives Within Contained Programs (Rule 2)

IDENTIFICATION DIVISION.
PROGRAM−ID. MAIN−PROGRAM.
.
.
.
PROCEDURE DIVISION.
DECLARATIVES.
FILEA−OUTPUT−PROBLEM SECTION.
USE GLOBAL AFTER STANDARD ERROR PROCEDURE ON OUTPUT.
FILEB−PROBLEM SECTION.
USE GLOBAL AFTER STANDARD ERROR PROCEDURE ON FILEB.
.
.
.
IDENTIFICATION DIVISION.
PROGRAM−ID. USE−PROGRAM.
.
.
.
PROCEDURE DIVISION.
DECLARATIVES.
FILEA−NAME−PROBLEM SECTION.
USE GLOBAL AFTER STANDARD ERROR PROCEDURE ON FILEA.
FILEB−INPUT−PROBLEM SECTION.
USE GLOBAL AFTER STANDARD ERROR PROCEDURE ON INPUT.
.

.
IDENTIFICATION DIVISION.
PROGRAM−ID. SUB2.
.
.
.
PROCEDURE DIVISION.
000−BEGIN.
OPEN INPUT FILEB.
.
.
.
OPEN OUTPUT FILEA.
.
.
.
END PROGRAM SUB2.
END PROGRAM USE−PROGRAM.
END PROGRAM MAIN−PROGRAM.

3

2

1

ZK−1427A−GE

.

12.5.2.4 Sharing Other Resources

Condition names, record names, and report names can also have the global
attribute. Any program directly or indirectly contained within the program
declaring the global name can reference the global name.

A condition name declared in a Data Description entry is global if the condition-
variable it is associated with is a global name.

A record name is global if the GLOBAL clause is specified in the Record
Description entry by which the record name is declared, or in the case of Record
Description entries in the File Section, if the GLOBAL clause is specified in the
File Description entry for the file name associated with the Record Description
entry.

A report name is global if the GLOBAL clause is specified in the Report
Description entry by which the report name is declared. In addition, if the
Report Description entry contains the GLOBAL clause, the special registers
LINE-COUNTER and PAGE-COUNTER are global names.

12–18 Interprogram Communication

Advertising