Declaratives
General Format:
[ DECLARATIVES.
{ section_name SECTION [opt_segment].
use-statement
[ procedure-para.
[ procedure-statement ] ... ] ... } ...
END DECLARATIVES. ]
Syntax:
section-nameis a user defined word that is the name of a section.opt-segmentis treated as commentary.- The
use-statementis a statement that begins with theUSEverb. procedure-parais a paragraph name.procedure-statementis an imperative or conditional statement.
General Rules:
- The
DECLARATIVESsection is used to assign procedural statements to be executed under different failure scenarios, as described in theUSEstatement. - For details on the usage of the
USEstatement, 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.
...