Professional Documents
Culture Documents
• EXCEPTION/ERROR declarative
• LABEL declarative
• DEBUGGING declarative
For general information about declaratives, see Declaratives.
LABEL declaratives are supported by IBM Enterprise COBOL for z/OS.
EXCEPTION/ERROR declarative
The EXCEPTION/ERROR declarative specifies procedures for input/output exception or
error handling that are to be executed in addition to the standard system procedures.
The words EXCEPTION and ERROR are synonymous and can be used interchangeably.
Format 1: USE (EXCEPTION ERROR declarative)
>>-USE--+--------+--AFTER--+----------+--+-EXCEPTION-+---------->
'-GLOBAL-' '-STANDARD-' '-ERROR-----'
.-------------.
V |
>--PROCEDURE--+----+--+---file-name-1-+-+----------------------><
'-ON-' +-INPUT-----------+
+-OUTPUT----------+
+-I-O-------------+
'-EXTEND----------'
file-name-1
Valid for all files. When this option is specified, the procedure is executed only for
the files named. No file-name can refer to a sort or merge file. For any given file, only
one EXCEPTION/ERROR procedure can be specified; thus, file-name specification
must not cause simultaneous requests for execution of more than one
EXCEPTION/ERROR procedure.
A USE AFTER EXCEPTION/ERROR declarative statement specifying the name of a
file takes precedence over a declarative statement specifying the open mode of the
file.
INPUT
Valid for all files. When this option is specified, the procedure is executed for all files
opened in INPUT mode or in the process of being opened in INPUT mode that get an
error.
OUTPUT
Valid for all files. When this option is specified, the procedure is executed for all files
opened in OUTPUT mode or in the process of being opened in OUTPUT mode that
get an error.
I-O
Valid for all direct-access files. When this option is specified, the procedure is
executed for all files opened in I-O mode or in the process of being opened in I-O
mode that get an error.
EXTEND
Valid for all files. When this option is specified, the procedure is executed for all files
opened in EXTEND mode or in the process of being opened in EXTEND mode that
get an error.
The EXCEPTION/ERROR procedure is executed:
LABEL declarative
The LABEL declarative (format 2 of the USE statement) is supported by IBM Enterprise
COBOL for z/OS. If a LABEL declarative is encountered by COBOL for AIX, a warning
message is issued and the declarative is ignored.
DEBUGGING declarative
Debugging sections are permitted only in the outermost program; they are not valid in
nested programs. Debugging sections are never triggered by procedures contained in
nested programs.
Debugging sections are not permitted in:
• A method