Compaq COBOL AAQ2G1FTK User Manual

Page 250

Advertising
background image

Handling Input/Output Exception Conditions
7.4 Using Declarative USE Procedures

INPUT—You can define only one INPUT Declarative USE procedure for each
program. This procedure executes for any unsuccessful exception condition if:
( 1 ) the file is open for INPUT and ( 2 ) a file name Declarative USE procedure
does not exist for that file.

OUTPUT—You can define only one OUTPUT Declarative USE procedure
for each program. This procedure executes for any unsuccessful exception
condition if: ( 1 ) the file is open for OUTPUT and ( 2 ) a file name Declarative
USE procedure does not exist for that file.

INPUT-OUTPUT—You can define only one INPUT-OUTPUT Declarative USE
procedure for each program. This procedure executes for any unsuccessful
exception condition if: ( 1 ) the file is open for INPUT-OUTPUT (I-O) and ( 2 )
a file name Declarative USE procedure does not exist for that file.

EXTEND—You can define only one EXTEND Declarative USE procedure
for each program. This procedure executes for any unsuccessful exception
condition if: ( 1 ) the file is open for EXTEND and ( 2 ) a file name Declarative
USE procedure does not exist for that file.

Note that the USE statement itself does not execute; it defines the condition
that causes the Declarative procedure to execute. Refer to the Compaq COBOL
Reference Manual
for more information about specifying Declarative procedures
with the USE statement.

Example 7–8 shows you how to include a USE procedure for each of the conditions
in your program. The example also contains explanatory comments for each.

Example 7–8 Five Types of Declarative USE Procedures

.
.
.

PROCEDURE DIVISION.
DECLARATIVES.
********************************************************
D1-00-FILE-A-PROBLEM SECTION.

USE AFTER STANDARD ERROR PROCEDURE ON FILE-A.

*
*
* If any file-access statement for FILE-A results in an
* error, D1-00-FILE-A-PROBLEM executes.
*
*
D1-01-FILE-A-PROBLEM.

PERFORM D9-00-REPORT-FILE-STATUS.
.
.
.

(continued on next page)

7–10 Handling Input/Output Exception Conditions

Advertising