Skip to content

Declaratives

General Format:

       [ DECLARATIVES. 
              { section_name SECTION [opt_segment]. 
                     use-statement 
              [ procedure-para. 
                     [ procedure-statement ] ... ] ... } ... 
       END DECLARATIVES. ]

Syntax:

  1. section-name is a user defined word that is the name of a section.
  2. opt-segment is treated as commentary.
  3. The use-statement is a statement that begins with the USE verb.
  4. procedure-para is a paragraph name.
  5. procedure-statement is an imperative or conditional statement.

General Rules:

  1. The DECLARATIVES section is used to assign procedural statements to be executed under different failure scenarios, as described in the USE statement.
  2. 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. 
       ...
Back to top