Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Imperative statements and imperative sentences

  • An imperative statement causes a specific action to be carried out in the object program.

  • An imperative statement is a statement which begins with an imperative verb and specifies that an action is to be executed unconditionally or a conditional statement which is delimited by its explicit scope terminator.

  • An imperative statement may consist of a sequence of imperative statements, each separated from the next by a COBOL separator.
    The imperative statements are:

    ACCEPT (7)
    ADD (1)
    ALLOCATE
    ALTER
    CALL (6)
    CANCEL
    CLOSE
    CLOSE DOCUMENT
    COMPUTE (1)
    CONTINUE
    DELETE (2)
    DISPLAY (7)
    DIVIDE (1)
    EXIT
    FREE
    GENERATE
    GO TO
    INITIALIZE
    INITIATE
    INSPECT
    INVOKE (7)
    MERGE
    MOVE
    MULTIPLY (1)
    OPEN
    OPEN DOCUMENT (8)
    PERFORM
    RAISE

    READ (4)
    RELEASE
    RESUME
    REWRITE (2)
    SET
    SORT
    START (2)
    STOP
    STRING (3)
    SUBTRACT (1)
    TERMINATE
    UNSTRING (3)
    WRITE (5)
    XML (7)

    (1)

    without the (NOT) ON SIZE ERROR phrase

    (2)

    without the (NOT) INVALID KEY phrase

    (3)

    without the (NOT) ON OVERFLOW phrase

    (4)

    without the (NOT) AT END or (NOT) INVALID KEY phrase

    (5)

    without the (NOT) INVALID KEY or (NOT) END-OF-PAGE phrase

    (6)

    without the ON OVERFLOW or (NOT) ON EXCEPTION phrase

    (7)

    without the (NOT) ON EXCEPTION phrase

    (8)without the (NOT) AT END phrase
  • Whenever "imperative-statement" occurs in the general format of statements, it also refers to a sequence of imperative statements terminated either by a period or by a phrase that belongs to a statement that contains an imperative statement. For example, the statement

    DIVIDE A INTO B.

    is an imperative statement because of the period that concludes it,

    as is DIVIDE in

     

    READ D AT END
           DIVIDE A INTO B
           NOT AT END ...
    

    because of “NOT ...” .

  • An imperative sentence is an imperative statement which is terminated by a period followed immediately by a space.