Compaq COBOL AAQ2G1FTK User Manual

Page 446

Advertising
background image

Interprogram Communication
12.5 Communicating with Contained COBOL Programs

IDENTIFICATION DIVISION.
PROGRAM-ID.

MAINPROG.

.
.
.
DATA DIVISION.
FILE SECTION.
FD

CUSTOMER-FILE
GLOBAL

.
.
.

Any special registers associated with a GLOBAL file are also global.

12.5.2.3 Sharing USE Procedures

The USE statement specifies declarative procedures to handle input/output
errors. It also can specify procedures to be executed before the program processes
a specific report group.

More than one USE AFTER EXCEPTION procedure in any given program can
apply to an input/output operation when there is one procedure for file name
and another for the applicable open mode. In this case, only the procedure for
file name executes. Figure 12–5 shows that FILE-NAME-PROBLEM SECTION
executes.

Figure 12–5 Sharing USE Procedures

IDENTIFICATION DIVISION.
PROGRAM−ID. MAIN−PROGRAM.
.
.
.
PROCEDURE DIVISION.
DECLARATIVES.
.
.
.
IDENTIFICATION DIVISION.
PROGRAM−ID SUB1.
.
.
.
PROCEDURE DIVISION.
DECLARATIVES.
FILE−NAME−PROBLEM SECTION.
USE AFTER STANDARD ERROR PROCEDURE ON FILE−NAME.
.
.
.
FILE−INPUT−PROBLEM SECTION.
USE AFTER STANDARD ERROR PROCEDURE ON INPUT.
.
.
.
END DECLARATIVES.
000−BEGIN.
OPEN INPUT FILE−NAME.
.
.
.
END PROGRAM SUB1
END PROGRAM MAIN−PROGRAM.

ZK−1429A−GE

2

1

12–16 Interprogram Communication

Advertising