Technical data
sentences. The remaining text in this section discusses each type of statement
and sentence in greater detail.
Table 4–2 Contents of COBOL Sentences
Type Contents of Sentence
Imperative One or more consecutive imperative statements ending with a
period
Conditional One or more conditional statements, optionally preceded by an
imperative statement, terminated by the separator period
Compiler-Directing Only one compiler-directing statement ending with a period
4.1.1 Compiler-Directing Statements and Sentences
A compiler-directing statement causes the compiler to take an action during
compilation. The verbs COPY, REPLACE, RECORD, or USE define a compiler-
directing statement. When it is part of a sentence that contains more than one
statement, the COPY, REPLACE, RECORD, or USE statement must be the last
statement in the sentence.
A compiler-directing sentence is one COPY, REPLACE, RECORD, or USE
statement that ends with a period.
4.1.2 Imperative and Conditional Statements and Sentences
An imperative statement specifies an unconditional action for the program. It
must contain a verb and the verb’s operands, and cannot contain any conditional
phrases. For example, the following statement is imperative:
READY UPDATE.
However, the following statement is not imperative because it contains the phrase
ON ERROR, which makes the program’s action conditional:
STORE PART-REC ON ERROR PERFORM BAD-STORE.
A delimited-scope statement is a special category of imperative statement used
in structured programming. A delimited-scope statement is any statement that
includes its explicit scope terminator. For more information, see the section on
Explicit and Implicit Attributes.
In the Procedure Division rules, an imperative statement can be a sequence
of consecutive imperative statements. The sequence must end with: ( 1 ) a
separator period or ( 2 ) any phrase associated with a statement that contains the
imperative statement. For example, the following sentence contains a sequence of
two imperative statements following the AT END phrase.
FIND NEXT PART-REC AT END PERFORM NO-MORE-RECS
DISPLAY "No more records." END-FIND.
An imperative sentence contains only imperative statements and ends with a
separator period.
Procedure Division 4–3