Declaratives
General Format:
[ DECLARATIVES.
{ section_name SECTION [opt_segment].
use-statement
[ procedure-para.
[ procedure-statement ] ... ] ... } ...
END DECLARATIVES. ]
Syntax:
section-name
is a user defined word that is the name of a section.opt-segment
is treated as commentary.- The
use-statement
is a statement that begins with theUSE
verb. procedure-para
is a paragraph name.procedure-statement
is an imperative or conditional statement.
General Rules:
- The
DECLARATIVES
section is used to assign procedural statements to be executed under different failure scenarios, as described in theUSE
statement. - For details on the usage of the
USE
statement, see the USE Statement General Rules section.
Code Sample:
...
PROCEDURE DIVISION.
DECLARATIVES.
IN-FILE-ERR SECTION.
USE AFTER STANDARD ERROR PROCEDURE ON INPUT.
REPORT-ERR-PARA.
DISPLAY"ERROR IN INPUT FILE. ".
DISPLAY"FILE-STATUS ITEM IS "FILE-STATUS.
CLOSE FILE-1.
ACCEPT DUMMY.
STOP RUN.
END DECLARATIVES.
...