Declaratives provide one or more special-purpose sections that are
executed when an exceptional condition occurs.
When Declarative Sections are specified, they must be grouped at the
beginning of the Procedure Division, and the entire Procedure Division
must be divided into sections.
Each Declarative Section starts with a USE statement that identifies the
section's function; the series of procedures that follow specify what
actions are to be taken when the exceptional condition occurs. Each
Declarative Section ends with another section-name followed by a USE
statement, or with the key words END DECLARATIVES. See "USE Statement" in
topic 8.1.15 for more information on the USE statement.
The entire group of Declarative Sections is preceded by the key word
DECLARATIVES, written on the line after the Procedure Division header; the
group is followed by the key words END DECLARATIVES. The key words
DECLARATIVES and END DECLARATIVES must each begin in Area A and be
followed by a separator period. No other text can appear on the same
In the declaratives part of the Procedure Division, each section header
must be followed by a separator period, and must be followed by a USE
statement, followed by a separator period. No other text can appear on
the same line.
The USE statement has three formats:
The USE statement itself is never executed; instead, the USE statement
defines the conditions that execute the succeeding procedural paragraphs,
which specify the actions to be taken. After the procedure is executed,
control is returned to the routine that activated it.
- EXCEPTION declarative (see "USE Statement" in topic 8.1.15)
- DEBUGGING declarative (see "USE Statement" in topic 8.1.15)
- X LABEL declarative (see "USE Statement" in topic 8.1.15)
Within a declarative procedure, except for the USE statement itself, there
must be no reference to any nondeclarative procedure.
X As IBM extensions, the following apply to declarative procedures:
Within a declarative procedure, no statement should be included that would
cause the execution of a USE procedure that had been previously invoked
and had not yet returned control to the invoking routine.
- X For AIX, OS/2, Windows, OS/390, and VM:
- X A declarative procedure can be performed from a nondeclarative
- X Additionally for OS/390 and VM:
- X A nondeclarative procedure can be performed from a declarative
- X A declarative procedure can be referenced in a GO TO statement in
X a declarative procedure.
- X A nondeclarative procedure can be referenced in a GO TO statement
X in a declarative procedure.
X You can include a statement that executes a previously invoked USE
X procedure that is still in control. However, to avoid an infinite loop,
X you must be sure there is an eventual exit at the bottom.
The declarative procedure is exited when the last statement in the
procedure is executed.
© Copyright IBM Corp. 1991, 1998
IBM Library Server Copyright 1989, 2005 IBM Corporation. All rights reserved.
Return to library:
IBM Hardware |
IBM System z Redbooks
How to order publications
Download IBM Library Reader |
Download IBM Softcopy Reader |
Download Adobe® Acrobat® Reader®
Download IBM Softcopy Librarian
Adobe, the Adobe logo, Acrobat, the Acrobat logo, and Acrobat Reader are registered trademarks
of Adobe Systems incorporated.