HP OpenVMS Systems Documentation |
HP COBOL
|
Previous | Contents | Index |
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.
4.2 Explicit and Implicit Scope Terminators
Scope terminators delimit the scope of some Procedure Division statements.
Explicit scope terminators for database programs are as follows:
END-COMMIT | END-FIND | END-READY |
END-CONNECT | END-FREE | END-RECONNECT |
END-DISCONNECT | END-GET | END-ROLLBACK |
END-ERASE | END-KEEP | END-STORE |
END-FETCH | END-MODIFY |
Implicit scope terminators are as follows:
A contained COBOL program can refer to a user-defined word in its containing program if the user-defined word has the global attribute. (See the section on User-Defined Words.) Some user-defined words always have the global attribute, some never have the attribute (that is, they are local), and some may or may not, depending on the use of the GLOBAL clause. The following rules explain how to use different kinds of user-defined words and what kinds of local and global name scoping to expect.
User-defined words in the Subschema Section are always global. The program defining this section and in any program it contains can reference these user-defined words:
Database key identifiers are indicated by the reserved words CURRENT, OFFSET, FIRST, and LAST as shown in the two formats below. FETCH and FIND may use database key identifiers to access database data records. Conditional clauses may also use them.
Database conditions allow alternate paths of control depending on the truth value of a test involving conditions specific to the database environment. The database conditions are the tenancy, member, and database key conditions.
Database exception conditions can occur during evaluation of these conditions. If a database exception condition occurs during the execution of a database condition, the Database Control System (DBCS) places a database exception condition code in the special register DB-CONDITION. This code identifies the condition. The DBCS also does the following:
Previous | Next | Contents | Index |